Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.dotnet.languages.vb,microsoft.public.word.mailmerge.fields
Chubbly Geezer
 
Posts: n/a
Default Mailmerge Automation Problems

Many thanks.

Seems the problem went away by removing the Connection and SQLStatement
strings.


"Peter Jamieson" wrote in message
...
You probably need something more along the following lines. In VBA you
shouldn't need the other parameters (most of them have no effect) but if
you do, put them back


wrdDoc.MailMerge.OpenDataSource(Name:="C:\Document s and Settings\pd.ISL\My
Documents\My Data Sources\webdev Subscriptions2
SubscriptionsPrintQueue.odc", Connection:="Provider=SQLNCLI.1;Data
Source=WEBDEV;Integrated Security=SSPI;Initial Catalog=Subsscriptions2;",
SQLStatement:="select * from ""subscriptionsprintqueue""",
SubType:=Word.WdMergeSubType.wdMergeSubTypeOther)

This assumes that you are using the "Native Client" OLEDB provider for SQL
Server 2005 access. You may still be able to use the old provider by
specifying Provider=SQLOLEDB.1 instead. You may need to specify the Data
Source as SERVERNAME\WEBDEV where you substitute your server name.

As long as the Connection and SQLStatement parameters contain everything
you need you can probably get away with a completely empty .odc file.

The double quotes around the table name in the Select statement are
probably optional.

Peter Jamieson

"Chubbly Geezer" wrote in message
...
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.







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
Error to Automation mailmerge to printer in word 2003 alamas Mailmerge 3 February 2nd 06 06:53 PM
get error 5361 in mailmerge automation sparty1022 Mailmerge 0 September 6th 05 05:03 PM
Mailmerge Querystring Problems hals left Mailmerge 2 August 23rd 05 03:31 PM
Problems with Mailmerge and odc hals left Mailmerge 0 August 9th 05 08:27 PM
Problems (again) getting Outlook contacts in Word 2002 Mailmerge Carl Mailmerge 1 January 21st 05 02:13 AM


All times are GMT +1. The time now is 09:45 AM.

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"