|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Aug 2007
Messaggi: 64
|
[Perl - Win32::OLE] Gestione file Excel aperto
Ciao a tutti
devo gestire dei filoe excel tutto fatto, solo che ogni volta che il file excel è aperto, quando faccio partire il programma, me lo chiude Codice:
...
my $file='Book.xls';
my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
my $workbook = $excel->Workbooks->Open( $file) or die "Error: can't open Workbook '$file'\n";
ho provato a fare un controllo Codice:
sub isWbOpen {
my $file=shift;
my $excel=shift;
if ($excel->Workbooks($file)->Activate) {
return 1;
} else {
return 0;
}
}
e quindi : Codice:
....
my $file='Book.xls';
my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit');
my $workbook;
if (isWbOpen($file,$excel)) {
$workbook=$excel->Workbooks($file)->Activate;
} else {
$workbook = $excel->Workbooks->Open( $file) or die "Error: can't open Workbook '$file'\n";
}
....
avete qualche suggerimento?? Grazie |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 14:18.



















