macro to save as pdf?

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I want a button to click on to save sheet 1 as a PDF using the current filename. Not quite sure where to start? Do I just record a macro while I'm saviing the sheet as a pdf?

Also, i'm using a pc - would my macros work on a mac?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
.
Code:
Option Explicit


Sub SveRngPDF()
Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Users\My\Desktop\" & ThisWorkbook.Name & ".pdf", Quality:= _
    xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
End Sub

Edit the path to match your computer.

Most macros that work on a PC will function on a MAC but I can't guarantee this macro will. You'll just have to try it.
 
Upvote 0
magic - thanks for that!
.
Code:
Option Explicit

Sub SveRngPDF()
Sheets("Sheet1").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Users\My\Desktop\" & ThisWorkbook.Name & ".pdf", Quality:= _
    xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
End Sub

Edit the path to match your computer.

Most macros that work on a PC will function on a MAC but I can't guarantee this macro will. You'll just have to try it.
 
Upvote 0

Forum statistics

Threads
1,222,749
Messages
6,167,967
Members
452,158
Latest member
MattyM

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