Save multiple sheets as PDF with multiple rule sets

Cheeze83

New Member
Joined
Nov 5, 2012
Messages
20
Hi All

I have a problem where I need to export 3 worksheets as a single PDF file.

I had one doing it as 3 seperate PDF files, which is below:

Code:
Sheets("Campaign Summary").Select

    pdfName = ActiveSheet.Name
    ChDir ActiveWorkbook.Path & "\"
    fileSaveName = ActiveSheet.Name
    
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
        
        Sheets("Lead Listing").Select


    pdfName = ActiveSheet.Name
    ChDir ActiveWorkbook.Path & "\"
    fileSaveName = ActiveSheet.Name
    
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=True, OpenAfterPublish:=False
        
        Sheets("Data Summary").Select


    pdfName = ActiveSheet.Name
    ChDir ActiveWorkbook.Path & "\"
    fileSaveName = ActiveSheet.Name
    
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        fileSaveName _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
    
    MsgBox "File Saved " & " " & fileSaveName

As you can see from this, the second tab has
Code:
IgnorePrintArea:=True
but the first tab has
Code:
IgnorePrintArea:=False

It needs to be this way, otherwise the sheets don't line up properly.

I have got a macro for saving it as one PDF which is:

Code:
ChDir ActiveWorkbook.Path & "\"fileSaveName = ActiveSheet.Name


ThisWorkbook.Sheets(Array("Campaign Summary", "Lead Listing", "Data Summary")).Select


ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
     IgnorePrintAreas:=True, OpenAfterPublish:=True

But because of only one Print Area declreation on of the sheets is coming up wrong.

I was looking to get a code where it saved the 3 seperate PDF's and then ran one combining them into one, however this document will be used by multiple people, and I don't want to run the risk of it going wrong across multiple machines.

Does anyone know of anything where you can save multiple sheets as a PDF but set the rule set for the sheets individually?

Thanks in advance
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Why not set the printarea's to suit? You can always reset it if needed.
e.g.
Code:
    ActiveSheet.PageSetup.PrintArea = "$A$1:$C$4"
    ActiveSheet.PageSetup.PrintArea = ""
 
Upvote 0
Why not set the printarea's to suit? You can always reset it if needed.
e.g.
Code:
    ActiveSheet.PageSetup.PrintArea = "$A$1:$C$4"
    ActiveSheet.PageSetup.PrintArea = ""

Of course! Thank you - I had been staring at it so long didn't even think of the simple solution, duh!

Thanks
 
Upvote 0

Forum statistics

Threads
1,222,562
Messages
6,166,804
Members
452,073
Latest member
akinch

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