How to export PDF with Vertical Orientation

KhallP

Board Regular
Joined
Mar 30, 2021
Messages
157
Office Version
  1. 2016
Platform
  1. Windows
I have the following code:


VBA Code:
Private Sub SaveAsPDF_Axis()

 Dim Counter As Integer, FindFileType As Integer, SaveAsFileName As String
    
    Select Case MachineName
        Case "A4", "A8.1", "A8.2", "A8.3", "A12.1", "A12.2", "A12.3", "A20.1", "A20.2"
        SaveAsFileName = "AC_Offset" & "_" & MachineName & "_" & Format(Now, "dd.mm.yyyy")
        
        With Application.FileDialog(msoFileDialogSaveAs)
            FindFileType = 0
            For Counter = 1 To .Filters.Count
                If InStr(VBA.UCase(.Filters(Counter).Description), "PDF") > 0 Then FindFileType = Counter
            Next
    
            .Title = "Save File As PDF"
            .InitialFileName = SaveAsFileName
            .FilterIndex = FindFileType
            
            If .Show Then
                Sheets("Final").Range(Cells(1, 1), Cells(68, 41)).ExportAsFixedFormat Type:=xlTypePDF, _
                Filename:=.SelectedItems(1), _
                Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
                .LeftMargin = Application.InchesToPoints(0)
                .RightMargin = Application.InchesToPoints(0)
                .BottomMargin = Application.InchesToPoints(0.2)
                .TopMargin = Application.InchesToPoints(0.2)
            End If
        End With
    End Select
    
End Sub

I need to specify that I want the PDF export to be done in a vertical orientation, how can I do that?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
The orientation of your sheet (Ribbon > Page Layout tab > Orientation > portrait or landscape) is decisive how your sheet will be exported to PDF.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top