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 / May 2007

Tip: Looking for answers? Try searching our database.

Mailmerge from Word 2003 using 2000 word template

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrew@AAP - 18 May 2007 06:14 GMT
Hi,

Ive been searching for answers for this for the last 2 days, however have
not found an answer, only reasons why the problem occurs.

We use Word Automation in one of our VB6 programs (which runs as an NT
service - completely unattended) Recently we upgraded the version of word
being referenced from 9.0 (word 2000) to word 11.0 (word 2003).

Since then i have noticed our service hangs, whenever a merge is performed
on a mailmerge document built under word 2000.

The reason appears to be due to the transition of how word links its data
source. I am aware of the transition of 2000's DDE to the JET used in 2003.

I have applied the registry update for SQLSecurityCheck. It does not work
for this problem.

The hanging is due to the program prompting for the datasource upon Opening
the word document itself (the WordApp.Documents.Open call), NOT calling the
OpenDataSource method (WordDoc.MailMerge.OpenDataSource).

   WordApp.DisplayAlerts = wdAlertsNone
   Set WordDoc = WordApp.Documents.Open(filename:=DocFile,
ConfirmConversions:=False, ReadOnly:=True) ', Format:=wdOpenFormatAllWord,
NoEncodingDialog:=True, Visible:=False)
   
   ' Make sure its a mailmerge document
   If WordDoc.MailMerge.MainDocumentType = wdNotAMergeDocument Then
       Err.Raise -1, , "This is not a valid mailmerge document."
   End If

   ' Open the data source
   If UCase(Mid(DataFile, Len(DataFile) - 2, 3)) = "XLS" Then
       WordDoc.MailMerge.OpenDataSource Name:=DataFile,
ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=False,
Connection:="Entire Spreadsheet", SubType:=wdMergeSubTypeWord2000
   Else
       WordDoc.MailMerge.OpenDataSource Name:=DataFile,
ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=False,
SubType:=wdMergeSubTypeWord2000
   End If

Any help appreciated. This is a big problem for us at present.
(I am also aware of Microsoft's statements warning against the use of office
automation in unattended applications)

Many Thanks,
Andrew
Peter Jamieson - 18 May 2007 06:35 GMT
Can we take it that you are still seeing the /SQL/ message and not some
other message?

Have you applied the SQLSecurityCheck registry change to the correct user
(i.e. the user account that the service is running under) ?

Peter Jamieson
> Hi,
>
[quoted text clipped - 49 lines]
> Many Thanks,
> Andrew
Andrew@AAP - 20 May 2007 23:00 GMT
Hi Peter,

Thanks for the replies.

Yes, the prompt for selecting the data source occurs for all data source
documents (excel or CSV)

I have applied the SQLSecurityCheck Registry "fix".

Quite frustrating that i now read that Office2007 has changes data
connectivity again.

Thanks,
Andrew

> Can we take it that you are still seeing the /SQL/ message and not some
> other message?
[quoted text clipped - 56 lines]
> > Many Thanks,
> > Andrew
Andrew@AAP - 18 May 2007 06:36 GMT
Forgot to add; The wordapp.documents.open method is actually throwing up the
"Select Data Source" window.

I cant find a workaround for this, particularly since this is an unattended
application its beginning to look like we need to define what versions of
word we are prepared to support.

> Hi,
>
[quoted text clipped - 45 lines]
> Many Thanks,
> Andrew
Peter Jamieson - 18 May 2007 06:57 GMT
Do you get this with all types of data source or a selection, e.g. the ones
that would have used DDE in Word 2000 (probably Access or Excel)?

If you open one of the "problem" documents manually, do you see the same
dialog box?

ISTR having to open mail merge main documents in Word 2002, updating all the
fields in the document, reconnecting to the data source(s) and re-saving as
Word 2002 documents, and not just because of the changes in the connection
methods. Probably the same for Word 2000-2003.

Peter Jamieson
> Forgot to add; The wordapp.documents.open method is actually throwing up
> the
[quoted text clipped - 60 lines]
>> Many Thanks,
>> Andrew
Andrew@AAP - 20 May 2007 23:04 GMT
Hi Peter,

> Do you get this with all types of data source or a selection, e.g. the ones
> that would have used DDE in Word 2000 (probably Access or Excel)?
Yes, all types, we allow our customers to submit CSV or Excel datasources.

> If you open one of the "problem" documents manually, do you see the same
> dialog box?
Yes.
The problem is trying to program around this.
In Word 2000 you would still get this box, but not until you call
OpenDataSource.
Now it appears to occur on the Open Word document itself.
Different stage of execution that i dont see an immeadiate way of coding
around.

> ISTR having to open mail merge main documents in Word 2002, updating all the
> fields in the document, reconnecting to the data source(s) and re-saving as
[quoted text clipped - 66 lines]
> >> Many Thanks,
> >> Andrew
Peter Jamieson - 21 May 2007 08:46 GMT
As far as I know, the situation is that a document that is already connected
to a data source and cannot find that data source when it opens will always
prompt for the data source (even in Word 2000 AFAICR), but Word 2002/2003 is
more particular about where that data source is actually located - if you
are relying on Word 2000 finding the data source in the same folder as the
mail merge main document, I suspect that will not work in Word 2002/2003.
Even if the user manages to get Word to open some types of data source the
first time around, in some cases (e.g. where the data source has a long
pathname), when you close/re-open the mail merge main document, Word my
"lose" the data source and throw up prompts. The "can't find the data
source" problem has AFAIK always been one of the problems with automating
merges.

Unfortuately I really don't think there is any way of reliably programming
around this unless you know what the data source is supposed to be
independently of the document. i.e., you could try to use Sendkeys to get
through the Select Data Source, but then you lose all information in the
merge main document about the name of the data source, so you can't
reconnect to it. It's difficult even to suggest what you might do in future
without knowing, for example, how much your customers are willing to do to
ensure that things work, how you ensure that the data sources used are
findable on the server, and so on.

FWIW I don't think Word 2007 is that much different from Word 2003 in this
area, but you would have to have the ACE driver/provider on your server as
well as the Jet one that it "replaces", and if you have to cope with DDE
connections you would need Excel 2007 as well.

I don''t think I can get you any further on this one, sorry.

Peter Jamieson

> Hi Peter,
>
[quoted text clipped - 93 lines]
>> >> Many Thanks,
>> >> Andrew
 
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.