Merge several single-sheet PDF into 1 file

blaksnm

Well-known Member
Joined
Dec 15, 2009
Messages
554
Office Version
  1. 365
Platform
  1. Windows
Hi
I have 3 routines. Each prints out its printarea, but 2 as portrait and 1 as landscape
When I try to print out in one multiple printarea I get my print (all 3 pages) either as portrait or landscape
How do I merge my 3 routines such as I get 1 PDF With alle 3 pages respectly placed?
Best Regards
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If you have more than one print area on a worksheet, it will not work out what you want, because the orientation affects the entire worksheet. If you have your print areas each on a separate worksheet, then place the worksheet tabs in the desired order. So if sheet 3 has to be the first page in the PDF, move its tab up front, followed by the tab that should be the second page and finally the tab for the third page.
If your workbook consists of just those three worksheets, the following will do:
VBA Code:
    ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\blaksnm\Documents\Book_1.pdf", Quality:=xlQualityStandard, _
                                     IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

If your workbook consists of more than those three worksheets, the following should work:
VBA Code:
Sub Example()
    Dim oWs     As Worksheet
    Dim vSht    As Variant
    
    vSht = Array("Sheet3", "Sheet1", "Sheet2")
    Set oWs = ThisWorkbook.Sheets(vSht(0))

    Sheets(vSht).Select
    oWs.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\blaksnm\Documents\Book_1.pdf", Quality:=xlQualityStandard, _
                            IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
 
Upvote 0
Thanks a lot! :)
This is just perfect!
BRr Snoopy
 
Upvote 0
You are welcome and thanks for letting me know.
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top