Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Excel save as PDF in 2 locations


Is there a way to create an excel sheet to PDF and have it save in 2 locations?



Selected Answer


You can just repeat the save line with 2 locations. 

In the attached file, the code in Module 1 is as follows. It saves the active sheet as a pdf (with the sheet name) in two locations. You will need to change the folder locations in bold:

Sub SavePdfX2()

Dim ws As Worksheet
Dim SvLoc1 As String, SvLoc2 As String

'Set folder locations
SvLoc1 = "E:\Documents\Spreadsheets\TeachExcel files"
SvLoc2 = "E:\Documents\Spreadsheets\TeachExcel files\Test files"

Set ws = ActiveSheet

' reuse variables to name pdfs
SvLoc1 = SvLoc1 & "\" & ws.Name & ".pdf"
SvLoc2 = SvLoc2 & "\" & ws.Name & ".pdf"

'save two pdfs (overwriting if necessary)
ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=SvLoc1, Quality:=xlQualityStandard
ws.ExportAsFixedFormat Type:=xlTypePDF, Filename:=SvLoc2, Quality:=xlQualityStandard

'tell user
MsgBox "Saved as: " & vbCr & vbCr & SvLoc1 & vbCr & vbCr & SvLoc2

End Sub

Hope this helps.


Answer the Question

You must create an account to use the forum. Create an Account or Login