I'll type this directly in so I might make a typo. You should be able to set 
the state in the application object:

$Excel->{WindowState} = -4140;

To set back to normal mode:

$Excel->{WindowState} = -4143;

The way to find this is to record a macro in Excel, and do what you want to 
see. Then view the macros and see what was done. In this case, the macro uses 
constants xlMinimized, and xlNormal. You can use the object browser to see the 
values of those constants. They're probably in the constants you have imported 
as well, so it would probably be better to use them there rather than the 
literal values.

See if this helps.

Steve

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neson Maxmelbin 
(RBEI/EMT4)
Sent: Thursday, August 14, 2008 4:30 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: WIN32::OLE help


Hello ,

I am using WIn32::OLE to Read contents of an Excel sheet.
There is no issues on reading, but the problem is that Excel file opens on the 
screen, during the time the script processes the file.

I don't need this.
One solution was to make it not visible ($Excel->{'Visible'} = 0;).
But this had some other problems. In some cases, when this Excel sheet was open 
for viewing, its contents were hidden ! , when we move the mouse over the 
cells, then we see it .. might be a Excel Bug. Due this we cannot make the 
Excel sheet invisible during the runnign of the script.

What I need now is to minimise the sheet once it is opened. How do we do it ?

My code extract -

use Win32::OLE::Const 'Microsoft Excel';

$Excel = Win32::OLE->GetActiveObject('Excel.Application')|| 
Win32::OLE->new('Excel.Application', 'Quit');

$Excel->{'Visible'} = 1;

$xlFile = 'C:\HWEConfig.xls';

eval { $Book = $Excel->Workbooks->Open("$xlFile"); };

... then the reading ....





Thanks and Regards
Maxmelbin Neson


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to