Create new book in existing copy of Excel?!

Hello,

The user has an instance of Excel running and viewing a book. Using Delphi 5, how do I use that instance of Excel to create my new book without calling another new instance of Excel?

Thanks in advance.
foxvisionAsked:
Who is Participating?
 
RBertoraConnect With a Mentor Commented:
Hi this should be what you are looking for:

uses comobj;

var
  ExcelApp : Variant;


    ExcelApp := GetActiveOleObject('Excel.Application');
    ExcelApp.Visible := True;

// load a work book
ExcelApp.workbooks.Open('LoadFileName.xls');

// open a new workbook:
ExcelApp.workbooks.Add;

// to run a new instance of excell:
    ExcelApp := createOleObject('Excel.Application');

// to quit
ExcelApp.Quit;

Rob ;-)
0
 
foxvisionAuthor Commented:
Thank you very much.
0
 
RBertoraCommented:
pleasure
good luck to you!
Rob ;-)
0
All Courses

From novice to tech pro — start learning today.