Invoice Numbers - Please Help!
What does "can't get it to work" mean?
The code appears to be fine if stored in a template file with E5 blank.
Workbooks created from that template will have increasing serial numbers.
In article ,
sherriq wrote:
This is all new to me so please be patient! lol
What I'm trying to do is to have automatic advancing invoice numbers in my
template. I'm using Excel 2003. This is what I've tried and just can't get
it to work. Any help would be appreciated. Thank you.
Private Sub Workbook_Open()
Const DEFAULTSTART As Integer = 1000
Const MYAPPLICATION As String = "Excel"
Const MYSECTION As String = "Wardinvoice2"
Const MYKEY As String = "Wardinvoice2Key"
Const MYLOCATION As String = "E5"
Dim regValue As Long
With ThisWorkbook.Sheets(1).Range(MYLOCATION)
If .Text < "" Then Exit Sub
regValue = GetSetting(MYAPPLICATION, MYSECTION, MYKEY,
DEFAULTSTART)
.Value = CStr(regValue)
SaveSetting MYAPPLICATION, MYSECTION, MYKEY, regValue + 1
End With
End Sub
|