Assign a unique number to a Excel Template


Posted by Pierre-Marc Lariviere on October 08, 2001 8:54 PM

Here is the problem, I did a invoice template and I need to find a way to create a counter who increase the number. I cannot do that in the same document because I don't allow the save. I need to find a way to get the info from an external files and make that number icreasing by one every time I will press (form) a button. Please I need help. Also, if someone know how to make a macro to quit excel. Best regards

Pierre

Posted by Travis Harr on October 08, 2001 9:37 PM

The following macro will close your workbook when run. This WILL NOT save. If you want to be prompted for a save, then set display alerts = true or remove this line.

Sub Workbook_Close()
Application.DisplayAlerts = False
ActiveWorkbook.Close
End Sub

If you are not going to save the template after you update the autonumber then how about Instead of an autonumber, make your invoice number some sort of timestamp for example use the formula =now() and do a custom format of "yymmddhhmm" This will automatically refresh evertime you open it. If you will have multiple invoices within 1 minute then make your format "yymmddhhmmss" to get down to the second.



Posted by Gyula Lorant on October 09, 2001 4:25 AM


Look at this :-

http://geocities.com/aaronblood/pages/vba.html
#21