Macro to select all worksheet and save file as file name

Luis Ferreira

New Member
Joined
Jan 2, 2012
Messages
13
Good Afternoon,

I want to create a macro that will select all the worksheets (names and quantity will vary) and saves the file as the current file's name but in PDF. Since I only know how to record a macro it specifies the worksheet names but I need it for various workbooks. The name will vary plus the number of tabs can go anywhere from 3 to 40.

Thank you,

Luis
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Sorry, couldn't get your point. What do you mean by Folder? Is it disk Folder? Do you mean the file is saved to the wrong folder?
 
Upvote 0
So you want to save the PDF file to the same folder of the original workbook. Correct?

You can select the folder via the folder dialog window and it will stay there until you change it.

Or, am I missing something?
 
Upvote 0
Sorry, the window opens but goes back one folder, I was wondering if there is a way to keep it in the same folder (current location)
 
Upvote 0
This is weird!

So when you run the macro you just get your PDF file, and nothing else?

The only advise i can give right now is to double check the code has been copied without any missing line. It is working just fine on my system.

When running the macro, you are supposed to see a window to select destination folder, then you get your PDF file preview. If the file already exists, then you will get a warning box.

Please check the above and let me know which part is not working.
 
Upvote 0
The window opens to select a folder, but I would like to save it on it is current location without having to select a folder.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,331
Members
452,636
Latest member
laura12345

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