Philip L Jackson Guest
|
Posted: Mon Nov 17, 2003 11:00 am Post subject: Office 2003 |
|
|
With the new version of office we are getting error messages
"the requested object is not available" - the code below has worked OK on XP
and all versions before.
Are there any mods I need to do for 2003 compatability? In my uses clause I
call word97.
Thanks in advance
Philip L Jackson
WordApplication:= TWordApplication.create(self);
try
with WordApplication do
begin
ConnectKind := ckNewInstance;
Connect;
Visible := TRUE;
FileName := SelectedFile;
try
WordDocument:= TWordDocument.create(self);
WordDocument.ConnectTo(WordApplication.documents.Open(fileName, emptyparam,
emptyparam, emptyparam,
emptyparam, emptyparam, emptyparam, emptyparam,
emptyparam, emptyparam));
WordDocument.MailMerge.Destination := wdSendToNewDocument;
confirm := FALSE;
Format := wdOpenFormatAuto;
FileToOpen := TempDocTable.TableName;
WordDocument.mailMerge.Execute(emptyparam);
WordApplication.ActiveWindow.DisplayVerticalScrollBar :=
TRUE;
savechanges := wdDoNotSaveChanges;
SystemTable.Active := TRUE;
WordApplication.ActiveWindow.WindowState :=
wdWindowStateMaximiz
Visible := TRUE;
except on E:Exception do
begin
MessageDlg(E.Message,mtError,[mbOK],0);
WordApplication.Quit;
end;
end;
end; // end of with WordApplication do
finally
WordApplication.Free;
WordDocument.Free;
end;
|
|