Why do you want to activate the sheet? The simple answer to your question is "It shouldn't - regardless of Excel version". Your "use" statements seem strange to me. I would expect to see use Win32::OLE; somewhere, and this may be part of your problem. I'm also surprised by your statement that you are using Excel 7, a version that appeared in 1995. My guess is that the strange way you are setting things up means that a workbook is being created with no sheets (I thought this was impossible) or that no workbook is being created. Anyway, on XP Pro and Excel 10 (I use it all the time - it has functionality missing in later versions), the following code seems to me to do what you want.
use strict; use warnings; use Win32::OLE; my $xl = Win32::OLE->new('Excel.Application'); $xl->{Visible} = 1; my $wb = $xl->Workbooks->Add; my $sht = $wb->Sheets("Sheet1"); $sht -> Range("B2") -> {Value} = 1234;
Regards,
John Davies
Update: if you really need to select the sheet - it can be necessary, rarely - $sht->Select; works for me.
In reply to Re: Perl and Excel 10
by davies
in thread Perl and Excel 10
by merrymonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |