Excel Invoice Template - Invoice Number Generator

Excel Invoice Number Generator


        When the invoice template is opened, it automatically creates a .txt file named" invoicenr.txt" in the folder it is in. In the created .txt file, 2000 number is entered as an example. Then, when Excel workbook is closed and opened, it can be seen that this number is 2001 on the invoice number cell (G3 cell).


       If  user wants , can enter a different number in the .txt file . When the workbook is closed and opened, the entered number will appear it increased one by one .
VBA function codes that enable the creation of the .txt file:
Public Function GetInvoiceNr() As Long
Dim WholeLine As String, fName As String
Dim InvNr As Long
Dim CommandButton2 As CommandButton
Dim sor

Application.DisplayAlerts = False
On Error GoTo NewFile
fName = ActiveWorkbook.Path & "\invoicenr.txt"
...
...
End Function


Read more ...