Hey,
I have a problem with exporting a range of data to an PDF file.
I looked around this website but none seems to give me the solution.
I am using this code to export a PDF file, which than will be attached to an email, this works perfect.
The range of cells it will pick is determent by the print range that has been set in excel, A1:I135
Within this range there a 2 page breakers, which will give me 3 pages.
Page 1 = A1:I54
Page 2 = A55:I108
Page 3 = A109:I135
The problem I have that when some of the data is hidden, because I don't need it, it will give me blank pages.
When Range 3 & 4 are hidden, the PDF will have a blank page in the middle.
When Range 1 & 2 & 6 are hidden, the PDF will have 3 pages but 2 are blank.
Range1 =A2:I27
Range2 = A28:I54
Range3 = A55:I81
Range4 = A82:I108
Range5 = A109:I135
Would it be possible to make a PDF file without the empty pages ?
So if Range 4 & 5 are hidden I will get only 2 pages.
If Range 3 & 4 are hidden I will get only 2 pages.
I have a problem with exporting a range of data to an PDF file.
I looked around this website but none seems to give me the solution.
I am using this code to export a PDF file, which than will be attached to an email, this works perfect.
VBA Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=strFileName, _
OpenAfterPublish:=False
The range of cells it will pick is determent by the print range that has been set in excel, A1:I135
Within this range there a 2 page breakers, which will give me 3 pages.
Page 1 = A1:I54
Page 2 = A55:I108
Page 3 = A109:I135
The problem I have that when some of the data is hidden, because I don't need it, it will give me blank pages.
When Range 3 & 4 are hidden, the PDF will have a blank page in the middle.
When Range 1 & 2 & 6 are hidden, the PDF will have 3 pages but 2 are blank.
Range1 =A2:I27
Range2 = A28:I54
Range3 = A55:I81
Range4 = A82:I108
Range5 = A109:I135
Would it be possible to make a PDF file without the empty pages ?
So if Range 4 & 5 are hidden I will get only 2 pages.
If Range 3 & 4 are hidden I will get only 2 pages.