Microsoft Office Tutorials and References
In Depth Information
AutoNumbering Invoices and Other Workbooks
End If¶
'Restore screen updating¶
Application.ScreenUpdating = True¶
End Sub¶
AutoNumbering Invoices and Other Workbooks
Exl
This macro shows how to create an AutoNumber field. It can be used across a
network or on a single PC.
Example file:
E028.xls
Scenario: When creating a template, such as one that can
be used for an invoice or a survey, it is usually required that
each workbook to have a unique number or 'key'.
This sample shows how to AutoNumber workbooks and demonstrates how it
can be used on a network where each individual, working from different PCs,
gets a different, sequential number each time.
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Type Template¶
Number As Long¶
DateStamp As Date¶
End Type¶
' * * * * *¶
Sub Autonumber()¶
'Variable declaration¶
Dim FilePath As String¶
Dim File As Long¶
Dim Counter As Long¶
Dim Temp As Template¶
Dim NewTemp As Template¶
'Change the following variables¶
FilePath = "\\Server\apps\Counter.txt"¶
FilePath = "C:\Counter.dat"¶
File = FreeFile()¶
 
Search JabSto ::




Custom Search