how do I automatically re-number my doc each time it's opened?

D

DJ Drayer

I can't seem to get Word to automatically add a form number (sequencially) to
my document...please help someone.

DJ
 
D

DJ Drayer

Jay, Thanks for the info, but I still can't get it to work. Even after I did
what the website you sent me to explained to do. I exactly what they told me
to and it still won't progress the numbering. Please help me...

DJ
 
D

DJ Drayer

Jay,
Thank you for the time to share the information I needed, one thing though,
after going to the link I did exactly what it told me to do and it is still
not working. And in the Autonew VBA there is a (Order, "00#") is that my
starting number? As I need to start with number 2536. Please help...

DJ
 
J

Jay Freedman

I'm sorry, but "not working" isn't enough information to diagnose the
problem.

Do you get any error message when you make a new document based on the
template? If so, what is the *exact* wording of the message?

Does the macro editor open and highlight any particular line of the
code?

If neither of those things happens, then what does happen?

To answer your other question, no, the "00#" is not the starting
number. Find the lines

If Order = "" Then
Order = 1
Else

and change the number 1 to 2536.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
D

DJ Drayer

The error message is as follows:
Runtime error 1-2147467259 (80004005)':

Then highlights this line;

System.PrivateProfileString("C:\Settings.Txt", "MacroSettings", "Order") =
Order

Thank you

DJ
 
J

Jay Freedman

I don't know what that error number means. The highlighted line is
trying to save the updated number into the file C:\Settings.txt. Maybe
there's some problem with that file path. Try making it some other
path, such as C:\Documents and Settings\Settings.txt.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
D

DJ Drayer

Thank you once again...I got it to work this morning where it automatically
saves under the proper number and location. The only thing left to do is to
is to find out how to get it to activate upon opening without me having to go
through the steps of opening and running the macro. Any suggestions?

DJ
 
J

Jay Freedman

If the macro is named AutoNew, as it was in the article, it will run
automatically when you use the File > New command to create a new document
based on the template (as explained in
http://www.word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm).

The macro should run _only_ when the document is first created. That places
the sequence number in the document at the bookmark, and it will stay there
permanently. The macro should _not_ run when you reopen an existing
document, because you don't want to replace the assigned number with a new
one.

If that isn't the behavior you're seeing, there may still be something wrong
with the way your template is set up.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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