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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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