I am trying to open an Excel (xlsm) file via VBA. It may or may not be protected with a (known) password. I am using this code:
On Error Resume Next
Workbook
Use 1004 error handling exclusively for this particular problem, and On Error Resume Next for everything else in the Sub.
Above the statement Workbooks.Open filename, Password:=user_entered_pw
also add another line statement without a password argument.
If those (or their combination) don't work, try scouring the .xlsm flat code in Notepad for any hint that a PW protected file differs at that level from one without. Use that info in a pre-opening function.