Discussion Locked

Word97 - Can template generate filename?

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am creating a Word97 template for a standard business form for my company. I need to put a field in the form which will generate an automatic ID number, which must be unique for each form created using the template, incremented by 1 for each new form. I must be able to define a starting point for the ID numbers. I also need to create a macro that will take that ID number, and upon the initial creation of a new document from the template, automatically save the file in a default directory using that unique ID number as the filename. Any ideas on how to do this?

5 replies

by proselyte

I am sure there is an easier way than the following but ...,
Use a text file to store the number, each time the form is used open the text file read the value and add one. This way you get your unique ID then use the "document.save as" functio to save the document.

Search help for more information about this (install vba help from office cd).

best regards

by dwassum

Good job, that did the trick! I actually figured it out before I saw your post, but I think using the text file may be the easiest way, short of generating the forms completely from a data source. Thanks for the valid suggestion. It helps to knowsomeone else had the same idea.

This discussion is closed to new replies.