use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Variant;
use Win32::OLE::NLS qw(:LOCALE :DATE);
$Win32::OLE::Warn = 3; # Die on Errors.
my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{DisplayAlerts}=0;
$Excel->{Visible}=1; #It's always good to see what it's doing...
my $Book = $Excel->Workbooks->Add();
my $Sheet = $Book->Worksheets(1);
$Sheet->Activate();
$Sheet->{'Name'} = "myworksheet";
my $cell = $Sheet->Cells(1,1); #personally, I like to use range, but
this works..
$cell->{Value} = 'mycell'; #you want the value not the name
print "My workbook name is $Book->{Name}\n"; print "My worksheet name is
$Sheet->{Name}\n"; print "My cell name is $cell->{Value}\n";
$Book->Save;
#Cheers,
#Steven
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of jagdish eashwar
> Sent: Sunday, May 14, 2006 7:04 AM
> To: PerlWin32
> Subject: OLE - GETTING EXCEL CELL NAMES
>
> Hi,
>
> I am unable to get the name of the cells in my excel
> worksheet though I can get those of my workbook and my
> worksheet. I have named my workbook as 'myworkbook', my
> worksheet as 'myworksheet, and cell A1 as 'mycell'.I am using
> the following code:
>
> use warnings;
> use strict;
>
> use Win32::OLE qw(in with);
> use Win32::OLE::Const 'Microsoft Excel'; use
> Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE);
>
> $Win32::OLE::Warn = 3; # Die on Errors.
>
> my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
>
> $Excel->{DisplayAlerts}=0;
>
> my $Book = $Excel->Workbooks->Add();
> my $Sheet = $Book->Worksheets(1);
> $Sheet->Activate();
> $Sheet->{'Name'} = "myworksheet";
>
> my $cell = $Sheet->Cells(1,1);
> $cell->{'Name'} = 'mycell';
> $Book->SaveAs('myworkbook');
> print "My workbook name is $Book->{Name}\n"; print "My
> worksheet name is $Sheet->{Name}\n"; print "My cell name is
> $cell->{Name}\n";
> $Book->Save;
>
> #End of script
>
> The output I am getting is :
>
> My workbook name is myworkbook.xls
> My worksheet name is myworksheet
> My cell name is Win32::OLE=HASH(0x1ce747c)
>
> Why am I unable to get the cell name?
>
> Thanks,
>
> Jagdish Eashwar
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs