Hello all. I created an invoice using the steps detailed in Podcast 1505 and everything works as planned; however, I'm getting a pop message each time I go to save the invoice. Below is the macro I'm using that I pulled from the message boards:
Sub SaveInvoiceBothWaysAndClear()
Dim NewFN As Variant
' Create the PDF First
NewFN = "T:\Outside Contract\PDF Invoices\Inv#" & Range("h3").Value & Range("i3").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
' Next, Save the Excel File
ActiveSheet.Copy
NewFN = "T:\Outside Contract\Excel Invoices\Inv#" & Range("h3").Value & Range("i3").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
' Increment the invoice number
Range("i3").Value = Range("i3").Value + 1
' Clear out the invoice fields
Range("A12:I23").ClearContents
Range("h3").ClearContents
End Sub
Attached is the error message I'm getting. I just want the file to save as a regular spreadsheet and generate a blank invoice. Thanks in advance for any help!
Sub SaveInvoiceBothWaysAndClear()
Dim NewFN As Variant
' Create the PDF First
NewFN = "T:\Outside Contract\PDF Invoices\Inv#" & Range("h3").Value & Range("i3").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
' Next, Save the Excel File
ActiveSheet.Copy
NewFN = "T:\Outside Contract\Excel Invoices\Inv#" & Range("h3").Value & Range("i3").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
' Increment the invoice number
Range("i3").Value = Range("i3").Value + 1
' Clear out the invoice fields
Range("A12:I23").ClearContents
Range("h3").ClearContents
End Sub
Attached is the error message I'm getting. I just want the file to save as a regular spreadsheet and generate a blank invoice. Thanks in advance for any help!