S
SLind
Hi,
I am using a certain Autonew VBA program to automatically generate a new
invoice number every time a certain word document is opened. Everytime I use
it, it works great UNLESS I switch users on my computer, it which case I get
the error message "Method 'PrivateProfileString' of object 'System' failed"
Any help is greatly appreciated. Here is the code, which was borrowed from
Doug Robbin's article "Creating sequentially numbered documents (such as
invoices)" from Microsoft MVP.
thanks again,
Steve
Private Sub Document_Open()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="order" & Format(Order, "#")
End Sub
I am using a certain Autonew VBA program to automatically generate a new
invoice number every time a certain word document is opened. Everytime I use
it, it works great UNLESS I switch users on my computer, it which case I get
the error message "Method 'PrivateProfileString' of object 'System' failed"
Any help is greatly appreciated. Here is the code, which was borrowed from
Doug Robbin's article "Creating sequentially numbered documents (such as
invoices)" from Microsoft MVP.
thanks again,
Steve
Private Sub Document_Open()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "00#")
ActiveDocument.SaveAs FileName:="order" & Format(Order, "#")
End Sub