I am struggling to export my worksheet as PDF.
Here is my code, FYI I am using Office 2016 for MAC
Sub saveactiveworkbook()
Dim FileName As String
Dim FolderName As String
Dim Folderstring As String
Dim FilePathName As String
ActiveSheet.PageSetup.Orientation = xlLandscape
FolderName = "TestVBA"
FileName = "DV" & ".pdf"
Folderstring = "/Users/Vallier/Documents/Test/TestVBA"
FilePathName = Folderstring & Application.PathSeparator & FileName
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
FilePathName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False
MsgBox FilePathName
End Sub
When I launch the program I have a warning box that says: "Run-time Error '1004':
Application-Defined or object-defined error"
I try to remedy to this by defining active sheet by "ws" upfront but I then have another error saying:
"ExportAsFormat of object_ worksheet failed"
Any ideas?
Many Thanks,