Macro to create excel to pdf based on listed sheets

manekankit

Board Regular
Joined
Feb 1, 2019
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Need help with macro to perform following task.

1. I have a file (Original file) with 5 sheets (Index, Report1, Report2, Report3, and Report4)
2. Colum B in Index sheet contains list of sheets for which pdf file is to be created (e.g. it contains Report1 and Report2 in cells B1 and B2 respectively). This list can increase or decrease.

Required:
1. Create a pdf file with sheets listed in column B of Index sheet.
2. Save that pdf file pre-defined name say'NewFile.pdf'.
3. PDF File should be saved to Original file path > Export > mmddyy (i.e. in the same path it should create 'Export' folder and in 'Export' folder it should create folder with dynamic name based on date(mmddyy) (eg. 11272022 for today) and file should be saved in this ddmmyy folder
4. PDF file should have pre-defined password ("ABC123").

Request you to help with macro code.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

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