Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / June 2007

Tip: Looking for answers? Try searching our database.

Save As -- Programmatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rodger - 31 May 2007 15:49 GMT
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
Peter Jamieson - 02 Jun 2007 10:45 GMT
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

> Hello all,
>
[quoted text clipped - 16 lines]
> TIA,
> Rodger
rodger - 02 Jun 2007 16:45 GMT
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

> 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
[quoted text clipped - 39 lines]
>> TIA,
>> Rodger
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.