E
Elisabeth
I am trying to created a form template (.dot) that has an invoice number that
automatically updates (+1) each time the template is used to created a new
document.
I found the following script for a macro that works great until I protect
the form. Then I get an error because the macro can't update a protected
area. I can't figure out how to "unprotect" the bookmark on the page so it
can update. Any ideas?
Sub AutoNew()
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(Date, "yymmdd" &
"-") & Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
automatically updates (+1) each time the template is used to created a new
document.
I found the following script for a macro that works great until I protect
the form. Then I get an error because the macro can't update a protected
area. I can't figure out how to "unprotect" the bookmark on the page so it
can update. Any ideas?
Sub AutoNew()
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(Date, "yymmdd" &
"-") & Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub