unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hello Gurus,
Basically, I need to open password protected PDF file even on read-only. I found this code online and wanted to ask if you can help to update the code.
= = = =
Sub Workbook_Open()
Application.DisplayAlerts = False
'Change 1234 to your file password accordingly
Dim pdfPath As String
pdfPath = Application.GetOpenFilename(filefilter:="PDF file (*.pdf), *.pdf")
Call OpenAnyFile(pdfPath)
Workbooks.Open Filename:="C:\Users\file.xls",
Password:="1234", ReadOnly:=True
Application.DisplayAlerts = True
End Sub
= = = = == = =
To do: I'll run the macro via excel and will no longer put the password over and over again since it is included in the code. Also, I'd like to use the option of asking for pathfolder and will choose the specific PDF file. Open as read only is fine.
Any help will be much appreciated.
Thank you!
Basically, I need to open password protected PDF file even on read-only. I found this code online and wanted to ask if you can help to update the code.
= = = =
Sub Workbook_Open()
Application.DisplayAlerts = False
'Change 1234 to your file password accordingly
Dim pdfPath As String
pdfPath = Application.GetOpenFilename(filefilter:="PDF file (*.pdf), *.pdf")
Call OpenAnyFile(pdfPath)
Workbooks.Open Filename:="C:\Users\file.xls",
Password:="1234", ReadOnly:=True
Application.DisplayAlerts = True
End Sub
= = = = == = =
To do: I'll run the macro via excel and will no longer put the password over and over again since it is included in the code. Also, I'd like to use the option of asking for pathfolder and will choose the specific PDF file. Open as read only is fine.
Any help will be much appreciated.
Thank you!