Hi,
I made an invoicing sheet and purchasing sheet (both separate documents) using information from Mr Excel and it has been working for a couple of months with no problem. I am now getting an error message and it will not work anymore. Screen shots etc below, any help would be very much appreciated.
I made an invoicing sheet and purchasing sheet (both separate documents) using information from Mr Excel and it has been working for a couple of months with no problem. I am now getting an error message and it will not work anymore. Screen shots etc below, any help would be very much appreciated.
VBA Code:
Sub NextPurchaseOrder()
Range("J2").Value = Range("J2").Value + 1
Range("B9:E9").ClearContents
Range("A10:E13").ClearContents
Range("H9:K9").ClearContents
Range("G10:K13").ClearContents
Range("A16:A26").ClearContents
Range("B16:H26").ClearContents
Range("I16:I26").ClearContents
Range("J3:K3").ClearContents
Range("B28:G28").ClearContents
Range("C30:G30").ClearContents
Range("H9:K9").ClearContents
End Sub
Sub SavePOWithNewName()
Dim NewFN As Variant
' Copy Purchase Order to a new workbook
ActiveSheet.Copy
NewFN = "C:\Users\ahollings\DC Emergency Systems LTD\DCESL Main Server - Documents\Ashley Hollings\Purchase Orders\POAH" & Range("J2").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=51
ActiveWorkbook.Close
NextPurchaseOrder
End Sub
Sub SavePurchaseOrderAsPDFAndClear()
Dim NewFN As Variant
NewFN = "C:\Users\ahollings\DC Emergency Systems LTD\DCESL Main Server - Documents\Ashley Hollings\Purchase Orders\POAH" & Range("J2").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=NewFN, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Range("J2").Value = Range("J2").Value + 1
Range("B9:E13").ClearContents
Range("A10:E13").ClearContents
Range("H9:K9").ClearContents
Range("G10:K13").ClearContents
Range("A16:A26").ClearContents
Range("B16:H26").ClearContents
Range("I16:I26").ClearContents
Range("J3:K3").ClearContents
Range("B28:G28").ClearContents
Range("C30:G30").ClearContents
Range("H9:K9").ClearContents
End Sub
Last edited by a moderator: