VBA code in Excel to increment invoice number and save the workbook as "Invoice" + "InvNo"
Posted on 2013-11-02
I had some VBA code in Excel and lost it, I will spare you the details. I need this code again. I need code that will increment the Invoice number which is saved in C:\Invoices\InvNo.txt and populate the next InvNo in the spreadsheet in cell F2 when opening the spreadsheet. I have been able to do this and replicate it and it works. Here is the part I can't remember. I need to save each worksheet or Invoice as Invoice9999.txt in C:\Invoices\Invoice9999.txt where the 9999 portion is the same InvNo that was used to populate cell F2 when opening. The end result is that the last InvNo is stored locally on the hard drive as well as the worksheet with the appropriate data for that InvNo. Over time, the local directory should have all the Invoices created stored as txt files with the InvNo showing in the name. Thanks for any help you can provide. The InvNo gets incremented at the opening of the spreadsheet and the file should be saved as a txt file when the spreadsheet is saved after data entry is completed. Thank you very much.