BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Office 2003

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Philip L Jackson
Guest





PostPosted: Mon Nov 17, 2003 11:00 am    Post subject: Office 2003 Reply with quote



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;


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.