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 / November 2003

Tip: Looking for answers? Try searching our database.

DataSource is unavailable in Word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amanda - 11 Nov 2003 23:07 GMT
I write an application using VB6. With Word 2003, I
cannot identify the datasource used when creating the
original mail merge document. (The original document can
have a datasource named anything under the sun. I do not
control the naming from the VB app.) With Word 97, 2000,
and 2002, I can get this information. With Word 2003, it
comes out empty. Here's an example of basic code to
reproduce this. Is there a different way of doing this?
(Alas, I need to control the merge from VB, NOT from Word
for my purposes, and I have no way of guaranteeing what
the datasource is named, so I need to be able to retrieve
it from the document.)

'dim variable here
Set WdDoc = WdApp.Documents.Open
("C:\somedirectory\Test1.doc")
SourceName = WdDoc.MailMerge.DataSource.Name

Note that the document referenced was created in MSWord
2003 using the "Type New List' option, selecting
the 'customize' option and creating a few of my own field
names. (F_AddressName, for example).

Thanks for any input!
A.
Peter Jamieson - 12 Nov 2003 09:41 GMT
> Here's an example of basic code to
> reproduce this. Is there a different way of doing this?
> (Alas, I need to control the merge from VB, NOT from Word
> for my purposes, and I have no way of guaranteeing what
> the datasource is named, so I need to be able to retrieve
> it from the document.)

Word 2003 has added a security check on the data source - basically, if it
thinks it's going to have to execute SQL (which is "almost always" when the
document is a mail merge main document), Word will pop up a dialog box when
the user opens a mail merge main document.

When you are opening the document programmatically, Word will just discard
the mailmerge datasource without warning (and you may see that referencing
WdDoc.MailMerge.DataSource.QueryString will probably generate an error)
/unless/ you use (say)

WdApp.DisplayAlerts = wdAlertsMessageBox

in which case the user is prompted when the document opens.

As far as I know the only other way you might be able to work around this
would be to follow

http://support.microsoft.com/default.aspx?scid=kb;en-us;825765

on each machine your code runs on.

--
Peter Jamieson
MS Word MVP

> I write an application using VB6. With Word 2003, I
> cannot identify the datasource used when creating the
[quoted text clipped - 21 lines]
> Thanks for any input!
> A.
Amanda - 12 Nov 2003 15:58 GMT
Thank you! We are one of the apparent few who are NOT
executing SQL statements with the merge. (we builde an
external file and it, in its entirety, is the mail
merge.) We'll implement the message by default and give
the users the option of changing settings and addressing
it at each workstation. (I think I'm on the path to
liking WordPerfect more and more each day.)

Thanks again!
A.
>-----Original Message-----
>> Here's an example of basic code to
[quoted text clipped - 5 lines]
>
>Word 2003 has added a security check on the data source -
basically, if it
>thinks it's going to have to execute SQL (which is "almost always" when the
>document is a mail merge main document), Word will pop up a dialog box when
[quoted text clipped - 47 lines]
>
>.
 
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.