A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

MailMerge from VBA



 
 
Thread Tools Display Modes
  #1  
Old August 14th, 2009, 01:52 PM posted to microsoft.public.word.mailmerge.fields
Vincent[_10_]
external usenet poster
 
Posts: 1
Default MailMerge from VBA

Hello,

My program is performing a mailmerge from within Microsoft Access
using VBA. The call to perform the actual merge is as follows:

wordApp.Documents(wordApp.ActiveDocument.Name).Mai lMerge.Execute false

The problem I am having is that the parameter sent to the execute call
(false), does not seem to be working in accordance with Microsoft's
documentation. If a merge field is missing from the document, the
document pauses and displays the error. According to the
documentation, if you set false as the value for the "pause"
parameter, then this should not happen--errors should be reported by
Word in a new document. I am using Microsoft Word 2007. Does anyone
know why Word is behaving like this and how to prevent it? Thanks.

Vincent
  #2  
Old August 14th, 2009, 02:43 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default MailMerge from VBA

Unfortnately the documentation makes a general statement about mailmerge
errors, whereas in fact /some/ types of error are reported in dialog
boxes regardless of this setting, including the type you mention. (In
that case, the error is also written to the error document when
Pause:=False).

for example, if you have a field with a syntax error such as

{ =1,1 }

then no dialog box appears and the error is written to the error
document as expected.

This is (presumably) why so many people need code that will help them
locate /every/ Merge field in a document - i.e. so they can remove or
fix the invalid ones pre-merge.

I don't think setting DisplayAlerts to wdAlertsNone makes any difference
in this case.

Peter Jamieson

http://tips.pjmsn.me.uk

Vincent wrote:
Hello,

My program is performing a mailmerge from within Microsoft Access
using VBA. The call to perform the actual merge is as follows:

wordApp.Documents(wordApp.ActiveDocument.Name).Mai lMerge.Execute false

The problem I am having is that the parameter sent to the execute call
(false), does not seem to be working in accordance with Microsoft's
documentation. If a merge field is missing from the document, the
document pauses and displays the error. According to the
documentation, if you set false as the value for the "pause"
parameter, then this should not happen--errors should be reported by
Word in a new document. I am using Microsoft Word 2007. Does anyone
know why Word is behaving like this and how to prevent it? Thanks.

Vincent

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.