VBA code to save as a PDF but let user choose location and file name?

Hayley Howells

New Member
Joined
May 20, 2014
Messages
6
Hi there, have had some fab help from this forum before so hoping someone can help me this time.

I'm looking for some VBA code to be linked to a button that selects all unhidden worksheets, then saves the selected sheets as a PDF, whilst allowing the user to select the save location on our network, and also letting the user choose the file name.

The background to this is that our team looks after 100 contractors, and I have 5 tabs in the workbook that use a drop down list to show data relevant to each contractor, but our admin team is going to generate the PDFs in advance of a programme of visits, so I need a user friendly button.

Ideally, within the VBA, there would also be a facility for the contractor name to be updated based on the admin staff selecting it once, on the front page (ie updating the selection on the summary page also cascades an update onto other pages.

Code wise, as far as I have got is to select all the sheets:

Sheets(Array("1.Practice Summary", "2.Generic Savings", "3.Not Recommended", "4.Items Less Suitable", "5.Specials")).Select

Not very far... I know!!!

In a perfect world, before selecting sheets, the cascade would occur with the contractor name (as selected on "Practice summary"), then after selecting all sheets, it would be saved as PDF within the users chosen location/file name. If it makes a difference, the contractor name is in the same cell on each sheet (B1).

Hope that makes sense! Any help appreciated!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

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