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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|