Adding as save to PDF function on Macro

tsymic

New Member
Joined
Oct 1, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I had a macro created to print the quote, incremental increase and clear data. I did have it save as an excel document, but now we would like it to save as a PDF. This is what I have in my system.

Sub PrintSaveIncrementalInvoice()
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Dim NewFN As Variant
Sub SaveActiveWorkbookAsPDF()

Sub SaveFileWithMacro()

Dim Path As String
Dim fn As String
Path = "C:\Users\Teresa\anvilmachine.ca\Document Portal - Documents\Quotes\Quote & Range("G10").Value & ".PDF"
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Path & fn & ".pdf"

Application.DisplayAlerts = True
ActiveWorkbook.Close
Range("G9").Value = Range("G9").Value + 1
'THIS CLEARS THE CELL RANGE, C13, G11, A18:I33, A36
[C12, A17:I40].ClearContents

End Sub


I'm not very good at Macros if anyone can help please!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Sub PrintSaveIncrementalInvoice()
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Dim NewFN As Variant
Sub SaveActiveWorkbookAsPDF()

Sub SaveFileWithMacro()
:unsure: You could review the code you posted, it seems you didn't include the complete macros.

Note Code Tag:
In future please use code tags when posting code.
How to Post Your VBA Code it makes your code easier to read and copy and it also maintains VBA formatting.

Example of how the code is seen within the code tag:
VBA Code:
Sub Macro2()
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
      Filename:="C:\Users\USER\Documents\example.pdf", _
      Quality:=xlQualityStandard, IncludeDocProperties:=True, _
      IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub

;)
 
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,069
Members
449,090
Latest member
fragment

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