Saving excel as pdf with macro

tchappell

New Member
Joined
Nov 16, 2018
Messages
4
I currently have about 100 companies that each have 2 excel files. Each quarter I need to take 1 tab from one book and insert it into the other book and save that entire book as a pdf. I tried doing a macro for some of this but what happens when I go to save the file is it replaces the original pdf file with the next one I'm in. So the macro is always saying "save as "book1.pdf"" instead of changing it to the file name i'm in, like "book2.pdf". How to do I adjust the code to keep the file name relative to the file that's open? Hopefully this is making sense. :/ All the tabs in both workbooks are exactly the same in every file. Thanks for any help, I know there has to be a faster way to consolidate these files.
 

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.
add a userform before the save that asks for a desired file name. store that, and then use it as the save name when vba is creating the save
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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