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
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
2,936
.
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
 

Forum statistics

Threads
1,085,010
Messages
5,381,209
Members
401,718
Latest member
Ereese20

Some videos you may like

This Week's Hot Topics

Top