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!
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Watch MrExcel Video

Forum statistics

Threads
1,109,053
Messages
5,526,502
Members
409,704
Latest member
saialkesh

This Week's Hot Topics

Top