jondavis1987
Active Member
- Joined
- Dec 31, 2015
- Messages
- 443
- Office Version
- 2019
- Platform
- Windows
Not sure what i'm doing wrong but i am trying to save different worksheets as PDFs. When i try to run this macro it highlights End sub and says suspected end with.
Code:
Sub save_Worksheets()
Dim WB As Workbook
Dim fName As String
' Export T-88to PDF
With srcWB
Dim LocationName As String
Dim WS1 As Worksheet
fName = Range("'Report'!J5").Value
LocationName = Range("'Report'!C6").Value
WS1 = "T-88"
WS1.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\jdavis\Dropbox\Quality Control\Jobs\" & LocationName & "\Soils\" & fName & " T-88", Quality:=xlQualityStandard, _
includeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
' Export T-89 & T-90 to PDF
With srcWB
Dim WS2 As Worksheet
fName = Range("'Report'!J5").Value
LocationName = Range("'Report'!C6").Value
WS2 = "T-89 & T-90"
WS2.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\jdavis\Dropbox\Quality Control\Jobs\\" & LocationName & "\Soils\" & fName & " T-89 & T-90", Quality:=xlQualityStandard, _
includeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
' Export T-99 to PDF
With srcWB
Dim WS3 As Worksheet
fName = Range("'Report'!J5").Value
LocationName = Range("'Report'!C6").Value
WS3 = "T-99"
WS3.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\jdavis\Dropbox\Quality Control\Jobs\\" & LocationName & "\Soils\" & fName & " T-99", Quality:=xlQualityStandard, _
includeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
' Export Report to PDF
With srcWB
Dim WS4 As Worksheet
fName = Range("'Report'!J5").Value
LocationName = Range("'Report'!C6").Value
WS4 = "Report"
WS4.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\jdavis\Dropbox\Quality Control\Jobs\\" & LocationName & "\Soils\" & fName & " Report", Quality:=xlQualityStandard, _
includeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub