'save as pdf' macro.....

jetson7

New Member
Joined
Aug 6, 2012
Messages
7
Hey. I'm a complete novice when it come to macros and am struggling. I need a macro that will save my selected worksheet by prompting me with the 'SAVE AS' dialog box. All links I have previously read only seem to include a specific file or file name. Can anyone please help?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Will work in Excel 2007 and later.

Code:
Sub exportPDF()
fName = Application.GetSaveAsFilename("", "PDF Files (*.pdf), *.pdf")
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, , , , , True
End Sub
 
Upvote 0
Bloody Brilliant! Thank you, have been tryin to figure this out for the past week. Cheers again!
 
Upvote 0
Will work in Excel 2007 and later.

Code:
Sub exportPDF()
fName = Application.GetSaveAsFilename("", "PDF Files (*.pdf), *.pdf")
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, , , , , True
End Sub

Maybe I was a little hastey. This script work to save all sheet but I need it to save just the sheet I am working on. I am also using a print area but this will always be static so I believe there is no need to write this into the macro. Is there a way to do the same as the above macro but just the active sheet? Any help is greatly appreciated.:biggrin:
 
Upvote 0
Will work in Excel 2007 and later.

Code:
Sub exportPDF()
fName = Application.GetSaveAsFilename("", "PDF Files (*.pdf), *.pdf")
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, , , , , True
End Sub


Maybe I was a little hastey. This script work to save all sheet but I need it to save just the sheet I am working on. I am also using a print area but this will always be static so I believe there is no need to write this into the macro. Is there a way to do the same as the above macro but just the active sheet? Any help is greatly appreciated.:biggrin:
 
Upvote 0
Will work in Excel 2007 and later.

Code:
Sub exportPDF()
fName = Application.GetSaveAsFilename("", "PDF Files (*.pdf), *.pdf")
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, , , , , True
End Sub


Maybe I was a little hastey. This script work to save all sheet but I need it to save just the sheet I am working on. I am also using a print area but this will always be static so I believe there is no need to write this into the macro. Is there a way to do the same as the above macro but just the active sheet? Any help is greatly appreciated.
 
Upvote 0
Maybe I was a little hastey. This script works to save all sheets but I need it to save just the sheet I am working on. I am also using a print area but this will always be static so I believe there is no need to write this into the macro. Is there a way to do the same as the above macro but just the active sheet? Any help is greatly appreciated.
 
Upvote 0
This would work:

Code:
Sub exportPDF()
fName = Application.GetSaveAsFilename("", "PDF Files (*.pdf), *.pdf")
[COLOR="#FF0000"]ActiveSheet[/COLOR].ExportAsFixedFormat xlTypePDF, fName, xlQualityStandard, , , , , True
End Sub

Note if multiple sheets are selected, all the sheets will be printed.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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