Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Rodger Rodger is offline
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
rodger rodger is offline
external usenet poster
 
Posts: 2
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cloning word page programmatically Arnaldo Microsoft Word Help 5 November 27th 06 09:29 PM
Turn off AutoCorrect in Word programmatically Supermozzie Microsoft Word Help 2 September 23rd 05 01:04 AM
Repeat header row programmatically packer_fan Tables 1 August 23rd 05 12:17 AM
Programmatically controlling Comment visibility WordNovice Microsoft Word Help 1 August 22nd 05 09:16 AM
Want to programmatically Add formfields. Judi Microsoft Word Help 4 February 17th 05 06:26 PM


All times are GMT +1. The time now is 07:32 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"