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 

Delphi 5 -> Delphi 2007 conversion, OLE (Excel, Word) proble

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





PostPosted: Sat May 19, 2007 3:22 am    Post subject: Delphi 5 -> Delphi 2007 conversion, OLE (Excel, Word) proble Reply with quote



Hi all

I've 'inherited' an app written in Delphi 5 that uses OLE for sending
output to Excel and Winword. The first problem I came across whilst doing
the conversion is that the code currently references 'Excel97' and
'Word97' - updating these to 'Excel2000' and 'Word2000' made this go away.
However there is this declaration:

var Sel: Selection;

.... and the 'Selection' type isn't recognised. It is used numerous times
in this kind of snippet:

With FormMain Do Begin
WordDoc := TWordDocument.Create(FormMain);
WordDoc.Connect;
Sel := WordDoc.Application.Selection;
End;

Can someone please point out the equivalent with the 'new' (2000) units?

Also the 'EmptyParam' constant no longer seems to be defined in the System
unit. Is there an equivalent for this to use in the case where I don't
wish to pass a parameter to an OLE function call?

I know only a little about the OLE side of things. Any help would be
greatly appreciated.

Cheers

Mike



--- posted by geoForum on http://delphi.newswhat.com
Back to top
Oliver Townshend
Guest





PostPosted: Sat May 19, 2007 8:12 am    Post subject: Re: Delphi 5 -> Delphi 2007 conversion, OLE (Excel, Word) pr Reply with quote



Quote:
I've 'inherited' an app written in Delphi 5 that uses OLE for sending
output to Excel and Winword. The first problem I came across whilst doing
the conversion is that the code currently references 'Excel97' and
'Word97' - updating these to 'Excel2000' and 'Word2000' made this go away.

There was nothing wrong with what you had. Anything that works in 97 will
work in 2000, unless theres some new feature you want to use. I suggest you
revert to the 97 units and save yourself a lot of work.

I don't know why selection isn't working, but the type units sometimes alias
it to Selection_ and the like. Alternatively you might need to pull in the
Office Type library as well.

Oliver Townshend
Back to top
MikeBoth
Guest





PostPosted: Sat May 19, 2007 8:12 am    Post subject: Re: Delphi 5 -> Delphi 2007 conversion, OLE (Excel, Word) Reply with quote



Quote:
There was nothing wrong with what you had. Anything that works in 97 will
work in 2000, unless theres some new feature you want to use. I suggest you
revert to the 97 units and save yourself a lot of work.

Thanks, but Delphi 2007 doesn't include the Word97.pas and Excel97.pas
files, only the newer (2000, XP) equivalents. Can I re-use these in Delphi
2007 somehow?

Mike



--- posted by geoForum on http://delphi.newswhat.com
Back to top
Oliver Townshend
Guest





PostPosted: Sat May 19, 2007 2:44 pm    Post subject: Re: Delphi 5 -> Delphi 2007 conversion, OLE (Excel, Word) Reply with quote

Quote:
Thanks, but Delphi 2007 doesn't include the Word97.pas and Excel97.pas
files, only the newer (2000, XP) equivalents. Can I re-use these in Delphi
2007 somehow?

I would have thought so.

Oliver Townshend
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.