Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic file names 1

Status
Not open for further replies.

mhypolite

Vendor
Feb 5, 2005
59
KY
Good Day All, I need a way to generate file names for word document automatically when a sure saves the document, is there any program that integrates with office to generate file names, or a macro I can use that when pressed will always generate a new file name for the document that is about to be saved?


Thanks in advance
 
Hi,

You might checkout this excellent site at this url:


and do a search on the site if it is not what you need.

You may need to be more specific and identify exactly what rules you want to apply to a new file, such as sequence numbers, user names, topic names, suffixes, etc. etc.

Let's know if you need more help.

Good Luck!

Peter Moran
 
Thanks PeterMoran, i have tried a similar macro to that, but it only works if its a new file, if the client already had a document that the open in word and wanted to save as a different copy, the macros does not work a second time
 
As Peter says, we really need a few more details - it can probably be done if we know what you want.

When a user does a Save As do you want an automatic save to the existing directory with a new name to occur, or do you want a new name to be generated as a default (and if so what would you want to happen if the user then changed the path in the Save As dialog). Are there any constraints on the new name - should it be the old name with a suffix or would "Doc1" be good enough?

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
well right now I got a macro that when clicked brings up the save as dialog and generates a name using a random function, the name for e.g. might be 7502347, basically just a random generated number. all I want to happen is anytime they activate a macro or save as it will always generate a random number for the file name, they user still have the option to put the file where ever they please. Or even some 3rd party utility that integrates and controls the file names
 
If you have a macro that does what you say, what exactly is it that you want?

If you want your macro to run when the user clicks Save As, try calling the macro "FileSaveAs".

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
The Macro only works on New documents, if i open an existing document already on disk, and wanted to save a copy with a different name and i use the macro it does not work. that’s why I was looking for another way of doing it
 
Try this a a start:
Code:
Sub FileSaveAs()
    With Dialogs(wdDialogFileSaveAs)
        .Name = Rnd()
        .Show
    End With
End Sub
If that's basically what you want we can adapt it.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
That code works like a charm, thanks man!! I can now integrate that into the formatted number generation code i use
 
mhypolite, "That code works like a charm, thanks man!!" - sounds like you ought to award a star. See the
[blue]Thank mhypolite
for this valuable post![/blue]

at the bottom left of Tony's post.



Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top