Save Excel document -Add statement and only save first page.

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I have a Macro and it works great as it saves my excel document as a PDF document, I would love to increase it's potential. I would like it to save only the first page, and have the words. "Pleasure ensure to reconcile activities with the previous month". If I can choose font 12 Times New Roman, and placed around the footer.

The macros is

VBA Code:
Sub save_for_WRS()
Dim saveLocation As String
saveLocation = "X:\2. (CUI) Activities Drop Box\05. (CUI) Logistics\Logistic Reports.PDF"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=saveLocation

End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try this macro:
VBA Code:
Public Sub Save_First_Page_As_PDF()

    Dim currentSelection As Range
    Dim currentView As XlWindowView
    Dim saveLocation As String
    
    saveLocation = "X:\2. (CUI) Activities Drop Box\05. (CUI) Logistics\Logistic Reports.PDF"
    
    Application.ScreenUpdating = False
    
    Set currentSelection = Application.Selection
    With ActiveWindow
        currentView = .View
        .View = xlPageBreakPreview
    End With

    With ActiveWorkbook.ActiveSheet
        .Rows("1:" & .HPageBreaks(1).Location.Row - 1).EntireRow.Select
        .PageSetup.CenterFooter = "&""Times New Roman,Regular""&12Please ensure to reconcile activities with the previous month"
    End With

    Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=saveLocation
        
    ActiveWorkbook.ActiveSheet.PageSetup.CenterFooter = ""
    
    ActiveWindow.View = currentView
    currentSelection.Select
    
    Application.ScreenUpdating = False

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,094
Latest member
bsb1122

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