Export PDF on multiple sheets

vbasquash

New Member
Joined
Jan 20, 2019
Messages
1
Dear members,

my situation:
I have multiple charts and other stuff on multiple worksheets. For example: Sheet 1: Range A1-C9, Sheet 1 Range F9:K13 and sheet 2: Range A1-F12


What i want to do: I want to put every element on ONE side in a PDF-document.


My problem:
I can export in PDF and i know the "pagesetup" commands that should fit my content onto one page. But i struggle doing it for every element.

In logical terms the could should do:

- go to sheet 1
- get range A1-C9
- Fit that onto ONE page
- go to sheet 1
- get range F9-K13
- Fit that onto ONE page
- go to sheet 2
- get range A1-F12
- fit that onto ONE page
- export PDF

can someone help me "designing" single pages in one pdf-document??

Thank you so much
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
.
The following uses Sheet3 as the location to paste to. You can change the code to any sheet you desire.

Code:
Option Explicit


Sub cpypstePDF()
Sheet1.Range("A1:C9").Copy Sheet3.Range("A1")
Sheet1.Range("F9:K13").Copy Sheet3.Range("A11")
Sheet2.Range("A1:F2").Copy Sheet3.Range("A17")


SveAsPDF
End Sub


Sub SveAsPDF()
Dim fileSaveName As String
Dim strTime, strFile, strPath As String


strTime = Format(Now(), "yyyymmdd\_hhmm")
strFile = ActiveWorkbook.Name & "_" & strTime
strPath = "C:\Documents\"


fileSaveName = Application.GetSaveAsFilename(InitialFileName:=strPath & strFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File Name to Save")


    
    Sheet3.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    
'confirmation message with file info
MsgBox "PDF file has been created: " & strFile


End Sub
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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