I am trying to open a password protected pdf on MS Word using Excel VBA but it shows me the Password screen for me to enter the password, though I have provided the PasswordDocument parameter. In case the PDF is not password protected, I am able to open it without a problem.
Code used:
In the above code, strFilePath contains the folder location (example: c:\) and strFileName contains the file name (example: 1.pdf).
Code used:
Code:
Set oDoc = objWord.Documents.Open( _
Filename:=strFilePath & strFileName, _
PasswordDocument:="@", ReadOnly:=True)
In the above code, strFilePath contains the folder location (example: c:\) and strFileName contains the file name (example: 1.pdf).