Need VBA Code to print pdf and save excel at same time with cell as file location and file name

oconee1985

New Member
Joined
Apr 19, 2020
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi, I am new to using VBA and bumbling my way thru. Im using excel professional plus 2016

I have a workbook with multiple worksheets. To give you some background I one worksheet that I enter an account number and I pull data from the other sheets. Additionally, I have set the print area on this worksheet for just the area that I need printed. Once I have pulled the data I need I then have to print the page to a pdf and then save the excel file with a new name and then start all over on the next account. What I would like to be able to do is to have three cells that have data I need the command to use

A1 Account Number (which will be the pdf and excel file name)
A2 folder location / file path to save pdf to (note this path will change every day)
A3 folder location / file path to save excel to (note this path will change every day)

So to summarize when I press the command button it will automatically print to a pdf using the data in A1 as the file name and A2 as the file path AND at the same time save the entire current workbook to file path listed in A3 using the account number as the file name which is located in A1.

Hopefully this gives all the data that is needed. I appreciate any help or feedback.
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Watch MrExcel Video

Forum statistics

Threads
1,112,788
Messages
5,542,517
Members
410,559
Latest member
jordansmith6532
Top