View Single Post
  #5   Report Post  
Posted to microsoft.public.dotnet.languages.vb,microsoft.public.word.mailmerge.fields
Chubbly Geezer
 
Posts: n/a
Default Mailmerge Automation Problems

Hi Peter

yes the Word UI can complete the merge.

Have already tried as suggested below, but get the same problem as before
when I either run the Macro from within Word or run the code from within VB.

When I try to execute, word shows a pop up stating that my merge field does
not exist. Would I like to remove it or use field 'M__' or 'M__1'.?

Chubbly

""Peter Huang" [MSFT]" wrote in message
...
Hi Chubbly,

Firstly I assume that you can use Word UI interactive operation to
complete
the MailMerge with the same DB.
I suggest you tried to follow the steps to retrieve the Macro to do mail
merge which is the same as we do in VB.NET.
1. Tools/Macro/Record Macro
2. Start your interactive operation of Mail Merge procedure and complete
that.
3. stop macro record
4. Press Alt+F11 to open the macro you recorded just now.
It should be similar with below.
ActiveDocument.MailMerge.OpenDataSource Name:= _
"path\odc" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther


This is the code you will use for your VB.NET program.

Please have a try and let me know the result.
Thanks!

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.