Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1241
  • Last Modified:

CreateOLEObject in Delphi 8 for .NET

Hi, I´m trying to develop a program automating OLE Applications such as EXCEL or AUTOCAD

I´ve tried this code for EXCEL

     var
       OleApplication :variant;
       OleWorkBook    :variant;

     procedure TForm1.FormCreate(Sender: TObject);
     begin
        OleApplication := CreateOleObject('Excel.Application');
        OleApplication.visible:=True;
        OleWorkBook:=OleApplication.Workbooks.Add;
     end;

But compiler reports this error :

[Error] Unit1.pas(104): Undeclared identifier: 'CreateOleObject'

When i try similar code for AutoCAD i gets an error in the same method.

What´s wrong ?
0
diordonez
Asked:
diordonez
1 Solution
 
Mohammed NasmanSoftware DeveloperCommented:
CreateOleObject doesn't exist in Delphi 8, as this comment from one of Borland employees
===========
From: Chris Bensen (nomail@borland.com)
Subject: Re: CreateOleObject!?!?
 
 
View this article only
Newsgroups: borland.public.delphi.com.interop.dotnet
Date: 2004-11-09 12:02:31 PST
 

Hi Richard,

CreateOleObject located in ComObj.pas has not been ported to
Borland.Vcl.ComObj.pas. You will need to either use CoCreateInstance or
generate an import assembly with tlbimp.exe or add a reference to the
type library and the IDe will generate the import assembly.

Chris

============
0
 
diordonezAuthor Commented:
OK, thanks  ! you´ve saved me a lot of time.

I´ve decided to downgrade to delphi 7, and it works well
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now