ExportAsFixedFormat cuts off Rows and Columns

cool1_boy1

New Member
Joined
Mar 19, 2013
Messages
21
I have a worksheet that I want to convert to PDF using ExportAsFixedFormat.
I have a subroutine, PrintSheet, that formats the sheet's margins, header/footer, etc.
If I print preview the sheet, everything looks great, but when I use ExportAsFixedFormat, the output PDF cuts off many rows and columns. Any suggestions?

Code:
Sub TestPrint()

    With ActiveWorkbook
        FileNameWithoutExtension = Left(.Name, (InStrRev(.Name, ".", -1, vbTextCompare) - 1))
        CurrentFolder = .Path & "\"
    End With


    With ActiveSheet
        Call PrintSheet(.Name)
        .Select
    End With
    
    With Selection
        .ExportAsFixedFormat Type:=xlTypePDF, Filename:=CurrentFolder & FileNameWithoutExtension & ".pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    End With


End Sub
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

cool1_boy1

New Member
Joined
Mar 19, 2013
Messages
21
K, I fixed it,
Code:
[COLOR=#333333]With Selection[/COLOR]
was selecting the cells to print. I wanted to print the entire worksheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,029
Messages
5,466,116
Members
406,468
Latest member
Toto Li

This Week's Hot Topics

Top