Nov 03 2019 07:20 AM
I have previously used a macro to call PDF Creator to save an invoice created in excel 365. However, it uses the old version of PDF Creator, because the new one has totally different methodology, names and calls.
Since the last update of Windows, whenever I call that macro, the print spooler hangs and freezes excel, so I am looking for a more up to date method that does not use an external programme.
I found "Macro to save as PDF with auto filename as cell value" https://answers.microsoft.com/en-us/msoffice/forum/all/macro-to-save-as-pdf-with-auto-filename-as-ce... from @Garys Student
But it does not work. It gives an error:
"Microsoft Visual Basic for Applications!
Compile error:
Syntax error"
Sub MacroPDF_Excel()
s = Range("C56").Value
'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
s, Quality:=xlQualityStandard, IncludeDocProperties _
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
The macro is a direct copy and paste from the example that others have made work.
I am getting the filename by pulling together various cells containing an invoice number and a date. The file location is OneDrive. This is the exact same filename and location that works in my old macro with PDF Creator v1
The cell content value shown in my spreadsheet in Cell C56 is this:
C:\Users\me\OneDrive\Folder\SubFolder\Sub-Sub_Folder\1403 Invoice 2019-10-31 from MyBusiness.PDF |
I have checked that putting
C:\Users\me\OneDrive\Folder\SubFolder\Sub-Sub_Folder\ |
into Windows File Explorer does take me to the correct folder.
I've tried it with the simple filename of "fred.pdf" in cell C56 instead of the complex one.
Am I doing something wrong or has the method changed since those examples?
Nov 15 2019 01:53 AM