supertitovic
New Member
- Joined
- Oct 17, 2017
- Messages
- 5
I have tried to find the solution everywhere, but I only find functions to export several sheets in a single PDF.
I want to export the same sheet and the same range, which is changing through a function, in a single PDF file.
For example, in the following code there is a loop that changes the values of a range 3 times.
How can I do to save a single PDF file that contains the range in triplicate and changed?
I have tried using Arrays but I don't know how to implement it in this specific case.
Thank you very much for the help
I want to export the same sheet and the same range, which is changing through a function, in a single PDF file.
For example, in the following code there is a loop that changes the values of a range 3 times.
How can I do to save a single PDF file that contains the range in triplicate and changed?
I have tried using Arrays but I don't know how to implement it in this specific case.
Code:
Dim i As Long
For i = 1 To 3
Call function_to_change_values 'this function change the values of range A1 to D5
'config printing:
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$5" 'print area
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Zoom = 77
.Draft = False
.PaperSize = xlPaperA4
End With
'create PDF:
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:\myfile.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Next i
Thank you very much for the help