Portucale
Member
Hi,
I have a code which "prints to a PDF" document, but for some reason it prints the completed workbook when I just wanted to print selected sheets, what do I have wrong :'(
Just a note, if I replace
by
it does print the 6 sheets, but they are blank (confused)...
Any help and all help is very much appreciated.
Thanks in advance,
I have a code which "prints to a PDF" document, but for some reason it prints the completed workbook when I just wanted to print selected sheets, what do I have wrong :'(
Code:
Private Sub PrintToPDF()
Dim strReportName As String
Dim strDataPath As String
Dim wb As Workbook
strReportName = "WR0023752 - WorkStack Deck.pdf"
strDataPath = "C:\DEVELOPER_FEEDS\WR0023752\"
Set wb = ActiveWorkbook
Sheets("Main").Activate
With ActiveSheet
.Shapes.Range(Array("Week")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "Week commencing: " & Range("V1").Value
.Range("A1").Select
End With
Sheets(Array("Main", "Page1", "RR-Triaged", "RR-NotTriaged", "WorkInProgress", _
"LastPage")).Select
Sheets("Main").Activate
'PrintOut 'Select
wb.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strDataPath & strReportName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=True
Sheets("Main").Select
End Sub
Code:
wb.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strDataPath & strReportName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=True, OpenAfterPublish:=True
Code:
Selection.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strDataPath & strReportName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
Any help and all help is very much appreciated.
Thanks in advance,