B
Barb
I was looking for a macro that would create a sequential number for
certificates that I create using a merge. Since I am not a programmer and
the only macros I've made were from recording keystrokes, I found the
following article with a great macro that worked on one computer but keeps
giving me errors when I try to use it on another
http://www.mvps.org/word/FAQs/MacrosVBA/NumberDocs.htm
I cut and pasted the code that was in the article. Does it create the
Settings.txt doc the first time it runs correctly? I tried copying the
Settings file to the other compueter too and it still didn't work. Any
ideas? Here's the code that I cut and pasted; the errors generated are
syntax, incorrect character, and a couple of others.
Sub AutoNew()
'
'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(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub
certificates that I create using a merge. Since I am not a programmer and
the only macros I've made were from recording keystrokes, I found the
following article with a great macro that worked on one computer but keeps
giving me errors when I try to use it on another
http://www.mvps.org/word/FAQs/MacrosVBA/NumberDocs.htm
I cut and pasted the code that was in the article. Does it create the
Settings.txt doc the first time it runs correctly? I tried copying the
Settings file to the other compueter too and it still didn't work. Any
ideas? Here's the code that I cut and pasted; the errors generated are
syntax, incorrect character, and a couple of others.
Sub AutoNew()
'
'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(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub