jagdish eashwar wrote:
> 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?
Not sure why, but try:
print "My cell name is $cell->{Name}{Name}\n";
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs