Hi all - i was sure this worked before - but now it doesn't. when i run this macro i get this error: run-time error 1004 Document not saved. The document may be open, or an error may have been encountered when saving.
the document is opened in desktop App but the document is opened from a sharepoint.
is it because it is on a sharepoint that it isn't working?
in debug mode this line is yellow:
the document is opened in desktop App but the document is opened from a sharepoint.
Code:
Sub Save_Sheets_As_PDF()
Dim replaceSelected As Boolean
Dim ws As Worksheet
Dim excludeSheets As String
excludeSheets = "|RAW|HOW-TO|" 'The sheet names to exclude delimited by "|"
With ThisWorkbook
replaceSelected = True
For Each ws In .Worksheets
If InStr(excludeSheets, "|" & ws.Name & "|") = 0 Then
ws.Select replaceSelected
replaceSelected = False
End If
Next
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Menu Card.pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
.Worksheets(1).Select True
End With
End Sub
is it because it is on a sharepoint that it isn't working?
in debug mode this line is yellow:
Code:
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Menu Card.pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True