Board index » delphi » excel in ole container

excel in ole container

Need help,
I'm running excel into an ole container, delphi 5.

This is the code:

{this is the id for 'Excel.Sheet.8' taken from my registry}
const
   clid: TGUID = '{00020820-0000-0000-C000-000000000046}';
var
   classname: string;

begin....

  try
    classname := ClassIDToProgID(clid);
  except
    on E: EOleSysError do
      if E.ErrorCode = REGDB_E_CLASSNOTREG then
        MessageDlg('Class not registered in the registry.', mtError, [mbOK], 0)
      else if E.ErrorCode = REGDB_E_READREGDB then
             MessageDlg('Error reading registry.', mtError, [mbOK], 0);
  end;
  {line n}
  OC.CreateObject( classname, true);

When executing {line n} I see this error message: "incorrect function".
Is there any other way to open an excel sheet object into my container?

Thank you,
Paul

--
 Paul-Sorin Maxan mailto:pma...@datalog.ro
 Home page: http://www.netsoft.ro/pmaxan

 

Re:excel in ole container


<<Paul Maxan:
  {line n}
  OC.CreateObject( classname, true);

When executing {line n} I see this error message:
"incorrect function".

Quote

I don't (D5). Do you get the same error if you try to
create a workbook, rather than a worksheet?

--
Deborah Pate

Other Threads