Originariamente inviato da franzauker2.0
Devi aprire un file Excel che contiene GIA' il foglio "foglio"
codice:
  XLApp := CreateOleObject('Excel.Application');
  XLApp.Visible := false;
  XLApp.Workbooks.Open('c:\file.xls');
  XLApp.Workbooks[1].Worksheets[1].Name := 'foglio';
  Sheet := XLApp.Workbooks[1].Worksheets['foglio'];
Et voilą.
MI sfugge qualcosa (come da firma ):

codice:
procedure TForm3.Elabora1Click(Sender: TObject);
var
XLApp: Variant;

begin  
L_v.Caption  := 'D:\bd1\file_supporto\Vi.xls';
try
XLApp := CreateOleObject('Excel.Application');
except  
on E : Exception do
begin
MessageDlg('Errore nella creazione dell''istanza Microsoft Excel.', mtError, [mbOK], 0);
 exit;
 end; 
XLApp.Visible := True; 
// provo ad aprire excel   
try 
 XLApp.WorkBooks.Open(L_vispi.Caption);
 XLApp.Workbooks[1].Worksheets[1].Name := 'Foglio1';
 Sheets := XLApp.Workbooks[1].Worksheets['mecojoni'];
except   
on E : Exception do  
 begin
  MessageDlg('Errore nell''apertura del file '+ L_vispi.caption , mtError, [mbOK], 0);     Exit;    
end; 
end;
Ho errore su Worksheets e Name ...

Cosa mi sfugge ?

Grazie