redskifreak
New Member
- Joined
- Mar 28, 2013
- Messages
- 2
I have copied this macro from one of your previous threads for making an invoice with increasing invoice number. I want the document to save as a PDF instead of an excel document.
Sub NextInvoice()
Range("i8").Value = Range("i8").Value + 1
Range("b21:h34").ClearContents
Range("b8:b10").ClearContents
End Sub
Sub SaveInvWithNewName()
Dim NewFN As Variant
' Copy Invoice to a new workbook
ActiveSheet.Copy
NewFN = "C:\Users\Jean\Desktop\Caramelized cook\" & Range("b8").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextInvoice
End Sub
I have changed the .xlsx extention to .pdf and it saves as a pdf but when i try to open it it gives me the error message "that it is either not a supported file or because the file has been damaged (for example it was sent as an email attachment was not correctly decoded)"
I am a macro newbie and would apperiacte some advise. Thank you in advance.
(don't mind my spelling)
Sub NextInvoice()
Range("i8").Value = Range("i8").Value + 1
Range("b21:h34").ClearContents
Range("b8:b10").ClearContents
End Sub
Sub SaveInvWithNewName()
Dim NewFN As Variant
' Copy Invoice to a new workbook
ActiveSheet.Copy
NewFN = "C:\Users\Jean\Desktop\Caramelized cook\" & Range("b8").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
NextInvoice
End Sub
I have changed the .xlsx extention to .pdf and it saves as a pdf but when i try to open it it gives me the error message "that it is either not a supported file or because the file has been damaged (for example it was sent as an email attachment was not correctly decoded)"
I am a macro newbie and would apperiacte some advise. Thank you in advance.
(don't mind my spelling)