On basis on an old tread I have been able to build this code, but I do not want active sheet in the array, and when comenting that out, I get "out of range".
As I have found that is as no start of array has been set? How to solve that?
But as I do not want Ac
As I have found that is as no start of array has been set? How to solve that?
VBA Code:
Sub pdf_export()
Dim wsNames() As String
Dim ws As Worksheet
ReDim wsNames(0)
'wsNames(0) = ActiveSheet.Name
For Each ws In ThisWorkbook.Sheets
If ws.Tab.ColorIndex = 4 And ws.Visible = xlSheetVisible Then
ReDim Preserve wsNames(UBound(wsNames) + 1)
wsNames(UBound(wsNames)) = ws.Name
End If
Next ws
Sheets(wsNames).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Left(ThisWorkbook.FullName, (InStrRev(ThisWorkbook.FullName, ".", -1, vbTextCompare) - 1)) & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
But as I do not want Ac