C
chrisa
Hi,
I am trying to automate a mail merge between Delphi and Word 2000.
Code below :
wrdApp := CreateOleObject('Word.Application');
wrdApp.Visible := FALSE;
wrdApp.Documents.Open(TemplateName);
wrdApp.ActiveDocument.MailMerge.OpenDataSource(Name :=
DataSourceName);
wrdApp.ActiveDocument.MailMerge.Destination :=
wdSendToNewDocument;
wrdApp.ActiveDocument.MailMerge.MainDocumentType := wdFormLetters;
wrdApp.ActiveDocument.MailMerge.Execute(False);
I am receiving an error on the Execute : "This method or property is
not available because the current mail merge main document needs a
data source.". So I did a bit of research and found out that the data
source is being removed coz of a security update. So I set
wrdApp.DisplayAlerts to wdAlertsShowAll but it still doesn't show the
message and therefore still fails. I found a reg hack listed by
Microsoft but it doesn't work for anything lower that Word 2003.
Btw, this code works fine in Word 2007. Any ideas???
Cheers,
Chris.
I am trying to automate a mail merge between Delphi and Word 2000.
Code below :
wrdApp := CreateOleObject('Word.Application');
wrdApp.Visible := FALSE;
wrdApp.Documents.Open(TemplateName);
wrdApp.ActiveDocument.MailMerge.OpenDataSource(Name :=
DataSourceName);
wrdApp.ActiveDocument.MailMerge.Destination :=
wdSendToNewDocument;
wrdApp.ActiveDocument.MailMerge.MainDocumentType := wdFormLetters;
wrdApp.ActiveDocument.MailMerge.Execute(False);
I am receiving an error on the Execute : "This method or property is
not available because the current mail merge main document needs a
data source.". So I did a bit of research and found out that the data
source is being removed coz of a security update. So I set
wrdApp.DisplayAlerts to wdAlertsShowAll but it still doesn't show the
message and therefore still fails. I found a reg hack listed by
Microsoft but it doesn't work for anything lower that Word 2003.
Btw, this code works fine in Word 2007. Any ideas???
Cheers,
Chris.