Essami
04-10-2018, 02:10 PM
Hi,
I've never used VBA / Macros with Excel before so please bare with me.
I'm trying to do a VBA to export multiple sheets (over 50) from one workbook to individual PDF's with their respective sheet names as file names for the PDFs.
I've tried numerous VBA codes from online but they all end up in some errors and I can't get any of them to work. I'm on a Mac and my Excel is the 2016 version. Any help to explaining what is wrong with the code below (or if there is a better code!) would be much appreciated.
Sub SaveAsPDF()
Dim CurWorksheet As Worksheet
For Each CurWorksheet In ActiveWorkbook.Worksheets
CurWorksheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Application.ActiveWorkbook.Path & “\” & CurWorksheet.Name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next CurWorksheet
End Sub
With this code I get the error "Compile error: Syntax error"
I've never used VBA / Macros with Excel before so please bare with me.
I'm trying to do a VBA to export multiple sheets (over 50) from one workbook to individual PDF's with their respective sheet names as file names for the PDFs.
I've tried numerous VBA codes from online but they all end up in some errors and I can't get any of them to work. I'm on a Mac and my Excel is the 2016 version. Any help to explaining what is wrong with the code below (or if there is a better code!) would be much appreciated.
Sub SaveAsPDF()
Dim CurWorksheet As Worksheet
For Each CurWorksheet In ActiveWorkbook.Worksheets
CurWorksheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Application.ActiveWorkbook.Path & “\” & CurWorksheet.Name, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next CurWorksheet
End Sub
With this code I get the error "Compile error: Syntax error"