atuljadhavnetafim
Active Member
- Joined
- Apr 7, 2012
- Messages
- 341
- Office Version
- 365
- Platform
- Windows
Hi,
I have multiple sheets in my file and I need to export as PDF from the selected range of selected sheets,
I have used the below code but it is not working properly, PDF generated but range not pick from as mentioned in the below code.
it takes from first sheet all data.
Please suggest if I need to arrange my sheets accordingly or need to change the sheet name in the below code.
I want to create a single PDF with 4 pages.
I have multiple sheets in my file and I need to export as PDF from the selected range of selected sheets,
I have used the below code but it is not working properly, PDF generated but range not pick from as mentioned in the below code.
it takes from first sheet all data.
Please suggest if I need to arrange my sheets accordingly or need to change the sheet name in the below code.
I want to create a single PDF with 4 pages.
VBA Code:
Sub CreatePDF()
Set ws1 = Sheets("Anantapur")
ws1.PageSetup.PrintArea = ws1.Range("C3:R37").Address
Set ws2 = Sheets("Singataluru")
ws2.PageSetup.PrintArea = ws2.Range("C3:R25").Address
Set ws3 = Sheets("Singataluru-3")
ws3.PageSetup.PrintArea = ws3.Range("C3:R10").Address
Set ws4 = Sheets("Tarikere")
ws4.PageSetup.PrintArea = ws4.Range("C3:R35").Address
ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="D:\Email\temp.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub