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 / April 2004

Tip: Looking for answers? Try searching our database.

Follow-up re: Open & Merge Doc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim - 06 Apr 2004 19:49 GMT
Option 2 below seems to work great. Under option 2, is
there code that can be added to the
AutoOpen macro that will cause the template/main merge
document to close
after merger, leaving the newly created/merged document
open?

Thank you in advance.

Jim

>-----Original Message-----
>I think you have two options - I'll just describe the
overview here.

>Option one is to use Access VBA instead of your macro
(I'm not that familar
>with Access but assume that by "macro" you mean the
simple, old-style
>sequence of commands). Or if possible, call an Access
VBA procedure from
>your Macro. Then get the VBA to open the Word document
using Automation.

>Option two is to put an AutoOpen macro in your Word
document. It would
>probably just need
>
>Sub AutoOpen()
>  ActiveDocument.MailMerge.Execute
>End Sub
>
>but you might need more code if you needed to specify an
output destination
>and so on.

message
>news:1040c01c40de2$26df87d0$a501280a@phx.gbl...
>> This is more of an Access question than a Word
question.
>> Unfortunately, I've listed it twice under the "Macro"
>> heading on the Access group, without response.  It
>> involves both programs.  Anyway, here goes:
>>
>> I have an Access 2000 db linked to Word 2000 documents
>> which contain merge fields and Word logic fields.  On a
>> form in the Access db users can click command buttons
and
>> open corresponding linked Word forms.  The command
>> buttons trigger an Access macro.  An example of the
>> command line in the Access RunApp macro triggered by
the
>> command button is as follows:
>>
>> C:\Program Files\Microsoft
>> Office\Office\winword.exe  "C:\PBdB11162001\Pleadings
>> (merge)\VoucherSheets.doc"
>>
>> Is there code I can add to the macro that will cause
the
>> Word doc not only to open, but to merge?  Or do I need
to
>> tackle this another way, such as from within Word, and
>> how might I do that.
>>
>> Thank you.
>>
>> Jim
Doug Robbins - Word MVP - 07 Apr 2004 05:17 GMT
Use

Sub AutoOpen()
Dim maindoc as document
Set maindoc = ActiveDocument
maindoc.MailMerge.Execute
maindoc.Close wdDoNotSaveChanges
End Sub

Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP

> Option 2 below seems to work great. Under option 2, is
> there code that can be added to the
[quoted text clipped - 64 lines]
>>>
>>> Jim
Jim - 09 Apr 2004 23:47 GMT
Thank you.  The code works great.  

Further follow-up questions: (1) Is there code that can
be added instructing/prompting the user to save the new
document under the name and to the file of their choice?;
(2) Alternatively, what code would be required to
automatically save the code to a file located on the C
drive named, for example,"CurrentDrafts"; and (3) After
adding code to my main merge documents, Each time they
open, I get the Message Box indicating the document
includes macros and asking if I want to enable or disable
them.  My inclination is to simply reduce the security
level so that this message doesn't appear.  If I reduce
the security for this one document, will that reduce the
level of security fall Word documents?  Is there a better
way to deal with this?

Thank you again

Jim

>-----Original Message-----
>Use
[quoted text clipped - 76 lines]
>
>.
Doug Robbins - Word MVP - 10 Apr 2004 09:13 GMT
Using

Sub AutoOpen()
Dim maindoc as document
Set maindoc = ActiveDocument
maindoc.MailMerge.Execute
maindoc.Close wdDoNotSaveChanges
ActiveDocument.Save
End Sub

Will cause the File Save dialog to appear after the merge has been executed.

DO NOT reduce the security level below Medium.

You could avoid the macro warning if you change the macro name to AutoNew
and save the mailmerge main document as a Template in the User or Workgroups
template directory and then use File>New and select the template rather than
File>Open.
Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps

> Use
>
[quoted text clipped - 73 lines]
>>>>
>>>> Jim
 
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.