Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Save As -- Programmatically
Hello all,
I have an Access Database that I use as my data source. I have forms with a list of all the Word Documents that the user can view/print. My question is this . . . . is there a way I can open the Word Document and change the name of the document. For Example the user is working on a file, lets say for Company X and they want to print out LetterX.doc, so when they open LetterABC.doc I would like it to be able to programmatically rename the letter to CompanyXLetterABC.doc. In theory I guess I could create a copy of file they are requesting, rename the file, and then open it up for them. So the merged file would have the new name. This could also ensure that the Master File is never edited by accident. Any thoughts? TIA, Rodger |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Save As -- Programmatically
If you use an Access VBA macro to launch the Word Mail Merge Main document,
yes, you could use the Word object model to save the document you opened under another name. Or you could set up your Mail Merge Main Documents to be Word templates (.dot) and create new documents based on them. Typically when you automate Word to do a MailMerge, you have code like Set objWord = CreateObject("Word.Application") Set objDoc = appWord.Documents.Open("the pathname of the .doc") To save the document under a new name, you could use objDoc.SaveAs Filename:="the new .doc name you want to use" However, I'd rather not go into more detail than that - it's probably better to have a look around for good examples using Google or Google Groups. Peter Jamieson "Rodger" wrote in message ... Hello all, I have an Access Database that I use as my data source. I have forms with a list of all the Word Documents that the user can view/print. My question is this . . . . is there a way I can open the Word Document and change the name of the document. For Example the user is working on a file, lets say for Company X and they want to print out LetterX.doc, so when they open LetterABC.doc I would like it to be able to programmatically rename the letter to CompanyXLetterABC.doc. In theory I guess I could create a copy of file they are requesting, rename the file, and then open it up for them. So the merged file would have the new name. This could also ensure that the Master File is never edited by accident. Any thoughts? TIA, Rodger |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Save As -- Programmatically
Peter,
Thank you that works perfectly. I am using VBA Code and doing just as you wrote. Never really thought to use the SaveAs method. Thanks again. Rodger "Peter Jamieson" wrote in message ... If you use an Access VBA macro to launch the Word Mail Merge Main document, yes, you could use the Word object model to save the document you opened under another name. Or you could set up your Mail Merge Main Documents to be Word templates (.dot) and create new documents based on them. Typically when you automate Word to do a MailMerge, you have code like Set objWord = CreateObject("Word.Application") Set objDoc = appWord.Documents.Open("the pathname of the .doc") To save the document under a new name, you could use objDoc.SaveAs Filename:="the new .doc name you want to use" However, I'd rather not go into more detail than that - it's probably better to have a look around for good examples using Google or Google Groups. Peter Jamieson "Rodger" wrote in message ... Hello all, I have an Access Database that I use as my data source. I have forms with a list of all the Word Documents that the user can view/print. My question is this . . . . is there a way I can open the Word Document and change the name of the document. For Example the user is working on a file, lets say for Company X and they want to print out LetterX.doc, so when they open LetterABC.doc I would like it to be able to programmatically rename the letter to CompanyXLetterABC.doc. In theory I guess I could create a copy of file they are requesting, rename the file, and then open it up for them. So the merged file would have the new name. This could also ensure that the Master File is never edited by accident. Any thoughts? TIA, Rodger |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cloning word page programmatically | Microsoft Word Help | |||
Turn off AutoCorrect in Word programmatically | Microsoft Word Help | |||
Repeat header row programmatically | Tables | |||
Programmatically controlling Comment visibility | Microsoft Word Help | |||
Want to programmatically Add formfields. | Microsoft Word Help |