How to know if Excel or a workbook is open ???

Please discuss general Delphi programming topics here.

How to know if Excel or a workbook is open ???

Postby Dave_lopez » May 12th, 2004, 9:55 am

Hi (Bonjour)
I just wanna know how to know if a workbooks is open.

I used to use this but it does'nt work the count method always send back
the zero value:


Code: Select all
If form2.ExcelApplication1.Workbooks.Count <> 0 Then
   begin
     for cpt := 0 to form2.ExcelApplication1.Workbooks.Count
      do
       form2.ExcelApplication1.Workbooks.Close( cpt);

end;

I need your help.
Merci / Thanks
Destiny exists ...
Dave_lopez
Member
Member
 
Posts: 3
Joined: May 12th, 2004, 9:54 am
Location: Paris

Postby Dave_lopez » May 12th, 2004, 11:16 am

Code: Select all
try
    vMSExcel := GetActiveOleObject('Excel.Application');
except
    vMSExcel := CreateOleObject('Excel.Application');
end;
Destiny exists ...
Dave_lopez
Member
Member
 
Posts: 3
Joined: May 12th, 2004, 9:54 am
Location: Paris


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron