I want to save my xls document as a PDF.
Some documents include the "Readme" sheet, some don't.
In this event, I set the condition leading to mandatory saving despite of the "Readme" sheet presence.
I found some hint here: Test or check if sheet exists
Sub sheet_exist()
Dim I As Long
For I = 1 To Worksheets.Count
If Worksheets(I).Name = "Readme" Then
Sheets("Readme").Visible = False
ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & ThisWorkbook.Name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Sheets("Readme").Visible = True
Else
ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ThisWorkbook.Path & "\" & ThisWorkbook.Name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Next I
End Sub
My PDF document is saved twice. How can I eliminate the second save?