June 21, 2024


Welcome to the core

Button to save sheet as PDF

Save Sheet as PDF

Create a new Button on sheet “Save as PDF” for example and attach the following code to it.

Open the Developer tab – Click here to see how to, we use this tab allot. – The starting point

Change – Sheets(Array(“SheetName“)).Select – To be the name of your sheet – Sheet1 – Export – PDF Sheet etc.

Sub Button1_Click()
Dim Ws As Worksheet
Dim Filename As String
Dim saveLocation As String
saveLocation = Application.GetSaveAsFilename( _
fileFilter:=”PDF Files (*.pdf), *.pdf”)
If saveLocation <> “False” Then
ActiveSheet.ExportAsFixedFormat xlTypePDF, saveLocation, xlQualityStandard
End If
End Sub
This will display a “Save as” window to let you pick the location of where to save the PDF.

Copyright © All rights reserved. | Newsphere by AF themes.