The primary user of the file is on a mac running Excel 2011 and he gets a runtime error
run-time error 1004: method ExportAsFixedFormat of object worksheet failed.
I'm not sure why it's not working on the Mac as it works on Windows. Hoping someone can help. Thanks so much!
Sub SaveAsPDF()
Application.ScreenUpdating = True
Dim theOS as String, fName as String
theOS = application.operatingsystem
if instr(1, theOS, "windows")>0 then
Sheet10.Visible = True 'this sheet is hidden from the user
Sheet10.Activate 'I realize this is redundant but it without this line we get an error
fName = Application.GetSaveAsFileName("","PDF Files (*.pdf), *.pdf")
if fName = "False" Then
Sheet10.Visible = False
Application.ScreenUpdating = False
Exit Sub
Else
ActiveSheet.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Sheet10.Visible = False
Else
Sheet10.Visible = True
Sheet10.Activate
fName = Application.GetSaveAsFilename("", Title:="Create PDF")
if fName = "False" then
Sheet10.Visible = False
Application.ScreenUpdating = False
Exit Sub
Else
'this is where the code fails
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=fName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Sheet10.Visible = False
End if
Application.ScreenUpdating = False
End Sub
Bookmarks