Hi,
I'm trying to save every sheet as a separate pdf using the code shown below. I can't get it to work. If I change the highlighted line to ActiveSheet.ExportAsFixedFormat I get the correct file names but all the files are the same when you open them so I feel like it's an issue with this line. I'm new to vba so I'm sure it's something obvious that I'm missing. Any help your be greatly appreciated.
Thanks!
Sub PrintToPDF()
Dim ws As Worksheet
For Each ws In Worksheets
ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:=ws.Name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Application.CutCopyMode = False
Next ws
End Sub
I'm trying to save every sheet as a separate pdf using the code shown below. I can't get it to work. If I change the highlighted line to ActiveSheet.ExportAsFixedFormat I get the correct file names but all the files are the same when you open them so I feel like it's an issue with this line. I'm new to vba so I'm sure it's something obvious that I'm missing. Any help your be greatly appreciated.
Thanks!
Sub PrintToPDF()
Dim ws As Worksheet
For Each ws In Worksheets
ws.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:=ws.Name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Application.CutCopyMode = False
Next ws
End Sub