Hi All,
I've found a macro online that I am using to save a fixed range to PDF, with the name generated by cells within the sheet. However when I try to run the macro it returns this:
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Helvetica Neue'}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Helvetica Neue'; min-height: 12.0px}</style>
This is the macro that I am using, when selecting debug it highlights the line containing the ExportAsFixedFormat command, I was also having this issue when testing with just the ExportAsFixedFormat command.
I am using Excel on a mac if that helps.
Thank you in advance for any help.
I've found a macro online that I am using to save a fixed range to PDF, with the name generated by cells within the sheet. However when I try to run the macro it returns this:
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Helvetica Neue'}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Helvetica Neue'; min-height: 12.0px}</style>
Run-time error '1004':
Application-defined or object-defined error
This is the macro that I am using, when selecting debug it highlights the line containing the ExportAsFixedFormat command, I was also having this issue when testing with just the ExportAsFixedFormat command.
Code:
Public Sub CreateInvoicePdf()
Dim outputFile As String
With Sheets("Invoice Creation")
outputFile = Environ("UserProfile") & "\Desktop\Quotes"
outputFile = outputFile & .Range("A1").Value & " " & .Range("E1").Value & " Invoice" & ".pdf"
.Range("A1:G45").ExportAsFixedFormat Type:=xlTypePDF, Filename:=outputFile
End With
End Sub
I am using Excel on a mac if that helps.
Thank you in advance for any help.