Password Protecting PDF via Excel

TemiU

Board Regular
Joined
Dec 11, 2014
Messages
52
Hello all Excel Experts!

I have VBA code which uses the .ExportAsPDF method to export my workbook to a PDF file.

I need to be able to password protect that PDF file so that it can not be modified. I can do this either with VBA or by running external (DOS) code.

Does anyone have any suggestions?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I need to be able to do it without third party apps, since other users will be running the code and will not necessarily have the same apps I do.
 
Upvote 0
Using the ExportAsFixedFormat method does not allow for a protection option. Also, it looks like Excel 2013 doesn't give the option to protect the file as outlined in the article above (when publishing using File->Export or File->Save As).

I wanted to know if, perhaps, anyone had some sort of code that I could run to "manually" encrypt the file.
 
Upvote 0
Actually what I need to do is make the file read only. The password is less important.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top