Excel to PDF with Password to view

Incompuk

New Member
Joined
Mar 9, 2016
Messages
4
Good morning,

I'm really needing some help on creating a Password Protected PDF using VBA. I need to do this for many files and already have a looped macro to create the PDF etc, just not password protect. Each file will also need to have a unique password found in a certain cell on the Excel file.

At the moment I've found some code to use PDF Creator but I'm using Excel 2013 and can;t even get past the "Dim pdfjob As PDFCreator.clsPDFCreator" without a User Defined Error.

I've enabled PDF Creator and Visual Basic in the references but still no luck.

Truly lost. Any help much appreciated.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
you can add this code before the pdf generation macro
Code:
if selection.value=xxx then
'code to generate pdf file
end if
 
Upvote 0
Hi, Thanks for the response, not quite sure how this helps though. When I step through the macro it's the Dim pdfjob As PDFCreator.clsPDFCreator that creates the user defined error.
 
Upvote 0
can you make your pdf generation code work without password?
i am not sure what method you use to generate the pdf file. i would use the save as option of save the entire or part of them sheet in pdf format.
 
Last edited:
Upvote 0
I can generate the PDFs no problem using excel, but using PDF Creator I can't even generate. The problem with using the Excel Save As method is that you can't password protect the PDF files.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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