When I run the code from the other post I get same error on this line Sheets(strSheetname).Copy
My Modifications in rep
Sub ExportRegions_PDF()
'Exports each WorkSheet to a seperate PDF-file and saves it using the Sheet Name
Dim wsCurrent As Worksheet
Dim strSheetname As String
Dim strPath As String
Dim strFileName As String
Dim lngIndex As Long
Dim strSkipSheets As String
strPath = "C:\Users\Douglas\Desktop\integ payroll\Las Vegas 2014\" '////change this path///
strSkipSheets = "WorkOrders, Roster, Overrides Perry Pappalalardo, Overrides Phillip Taylor, Overrides Kenneth Imerti, Overrides Danny Sevilla, Overrides David Belikove, Override Sheet Dex Stevens, Overrides James Budd, Invoice Breakdown, Account Database"
Application.DisplayAlerts = False
For Each wsCurrent In Worksheets
If InStr(1, strSkipSheets, wsCurrent.Name) = 0 Then
strSheetname = wsCurrent.Name
wsCurrent.Copy
If Sheets(strSheetname).Range("AH9").Value <> "" Then
strFileName = Sheets(strSheetname).Range("AH9").Text
Else
strFileName = strSheetname
End If
ActiveWorkbook.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPath & "" & strFileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
ActiveWorkbook.Close False
End If
Next wsCurrent
Application.DisplayAlerts = True
End Sub
Bookmarks