Creating sequentially numbered documents (such as invoices)

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
 
W

Word Heretic

G'day "Barb" <[email protected]>,

at a glance it all looks ok to me - what err do u get and where?


Steve Hudson
Word Heretic Sydney Australia
Tricky stuff with Word or words

Email: WordHeretic at tpg.com.au


Barb was spinning this yarn:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top