I use the following macro on a check request form. What is does is give my users (122) the ability to open the check request and have it increment 1 number each time they use it. The macro (lives on the server and they all access the same template) sometimes people will not get a number or they get an error but I see nothing wrong with the vb code.
Sub AutoNew()
‘/Purpose: So that the check number will increment 1 num each time opened.
‘/Created: 8/30/02 12:51 PM
‘/Created By: kstaker
Dim rngtemp As Range
On Error GoTo Err_AutoNew
OrderNew = System.PrivateProfileString(“G:Settingsnew.Txt”, “MacroSettings”, “OrderNew”)
If OrderNew = “” Then
OrderNew = 71000
Else
OrderNew = OrderNew + 1
End If
System.PrivateProfileString(“G:Settingsnew.txt”, “MacroSettings”, “OrderNew”) = OrderNew
ActiveDocument.Bookmarks(“OrderNew”).Range.InsertBefore Format(OrderNew, “00#”)
Set rngtemp = ActiveDocument.Bookmarks(“OrderNew”).Range.Duplicate
rngtemp.Expand unit:=wdWord
ActiveDocument.Bookmarks(“OrderNew”).End = rngtemp.End
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Exit_AutoNew:
Let me know if you see something that I am missing.