Excel 2007 Save As PDF Macro

shaw600

New Member
Joined
Dec 2, 2016
Messages
9
Hi

I recently created a macro in Office 365 to save as a PDF, here's the code:


Sub Save_PDF_Quote() Dim Path As String
Dim filename As String
Path = "C:\Users\RISING SUN\Google Drive\Rising Sun Construction\Quotes\PDF"
filename = Range("H16")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Path & filename & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
From:=1, To:=1, OpenAfterPublish:=True
End Sub

But it doesn't seem to work in Excel 2007. Please help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I use this code:

Code:
Sub Save_PDF_Quote()


Dim StrFilePathAndName As String
    With Sheets("[B][I]YourSheetName[/I][/B]")
        StrFilePathAndName = "C:\Users\RISING SUN\Google Drive\Rising Sun Construction\Quotes\PDF" & "\" & .Range("H16") & ".pdf"
    End With

    With Sheets("[B][I]YourSheetName[/I][/B]")
        .Range("Print_Area").ExportAsFixedFormat _
        Type:=xlTypePDF, FileName:=StrFilePathAndName, _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, OpenAfterPublish:=True
    End With
End Sub
 
Last edited:
Upvote 0
Hi Tim, Thank you but that still hasn't worked, it's telling me that there is an issue with this section:

.Range("Print_Area").ExportAsFixedFormat _ Type:=xlTypePDF, filename:=StrFilePathAndName, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True

If it can't be saved as a PDF could it be printed as a PDF?
 
Upvote 0

Forum statistics

Threads
1,213,522
Messages
6,114,112
Members
448,549
Latest member
brianhfield

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