Not sure whether you are asking how to manage an incrementing number or how to save the file with this name, so I'll cover both.
I use a range name in VBA () to manage the number. I check in the workbook_open to see if it exists, if not then I seed it.
Const InvName As String = "__Invoice"
Private Sub Workbook_Open()
Dim nTemp
On Error Resume Next
nTemp = Evaluate(ThisWorkbook.Names(InvName).RefersTo)
On Error GoTo 0
If IsEmpty(nTemp) Then
ThisWorkbook.Names.Add Name:=InvName, RefersTo:=1
End If
End Sub
Then, when you want to save the file, you just pick up that name value.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim iPos As Long
Dim sfile As String
On Error GoTo wb_exit
Application.EnableEvents = False
sfile = ThisWorkbook.Name
iPos = InStr(sfile, "#")
If iPos > 0 Then
sfile = Left(sfile, iPos - 2)
Else
If Right(sfile, 3) = "xls" Then
sfile = Left(sfile, Len(sfile) - 4)
End If
End If
sfile = sfile & " #" & _
Format(Evaluate(ThisWorkbook.Names(InvName).RefersTo), "000")
sfile = IIf(ThisWorkbook.Path = "", sfile, ThisWorkbook.Path & "\" & sfile)
ThisWorkbook.SaveAs sfile
Cancel = True
wb_exit:
Application.EnableEvents = True
End Sub
This is workbook event code. To input this code, right click on the Excel icon on the worksheet (or next to the File menu if you maximise your workbooks), select View Code from the menu, and paste the code