I have the following code to export a pdf of four worksheets in a workbook:
the problem I am having is that some of the pages on the pdf are not A4, they are ridiculously large in comparison to the others. Although, when I select the tabs manually and print to PDF, everything is fine.![]()
Sub exportfile() Dim myArray myArray = Array("Cover Sheets", "profit and loss", "balance sheet", "wet and dry GP breakdown") Sheets(myArray).Select Selection.Activate myPath = ThisWorkbook.Path & "\" sFileName = myPath & Range("client").Value & " - Management accounts - " & _ Format(Range("manp").Value, "dd Mmm yyyy") 'Without .pdf 'Check if file exists If Dir(sFileName & ".pdf") <> "" Then sFileName = sFileName & Format(Now(), "_hh-mm") End If On Error Resume Next sFileName = Left(sFileName, 214) ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=sFileName & ".pdf", _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=True Sheets("cover sheets").Select End Sub
Any ideas?
thanks,
dan.











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks