A
Andrew@AAP
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
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