Hi there,

I am using ActivePerl 5.6.1 build 630, and I intend to format and print
worksheets automatically.
I derived from a macro for this something like:

use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Variant;
$Win32::OLE::Warn = 3;                                # die on errors...

my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
    || die "This script formats the CURRENT ACTIVE Excel workbook...\n";

my $Book= $Excel->ActiveWorkbook;
my $Sheet= $Book->ActiveSheet;

$Sheet->PageSetup->{'PrintArea'}= "";
with( $Sheet->PageSetup,
      LeftHeader => '',
      CenterHeader => '',
      RightHeader => 'printed on &D - &T',
      LeftFooter => '&F / &A',
      CenterFooter => '',
      RightFooter => '&P / &N',
      LeftMargin => $Excel->Application->InchesToPoints(0.590551181102362),
      RightMargin =>
$Excel->Application->InchesToPoints(0.590551181102362),
      TopMargin => $Excel->Application->InchesToPoints(0.78740157480315),
      BottomMargin =>
$Excel->Application->InchesToPoints(0.78740157480315),
      HeaderMargin =>
$Excel->Application->InchesToPoints(0.511811023622047),
      FooterMargin =>
$Excel->Application->InchesToPoints(0.511811023622047),
      PrintHeadings => 0,  # False,
      PrintGridlines => 0, # False,
      PrintComments => xlPrintNoComments,
      PrintQuality => 600,
      CenterHorizontally => 1, # True,
      CenterVertically => 0,   # False,
      Orientation => xlLandscape,
      Draft => 0,  # False,
      PaperSize => xlPaperA4,
      FirstPageNumber => xlAutomatic,
      Order => xlDownThenOver,
      BlackAndWhite => 0,  # False,
#      Zoom => '',  # False,  # does not work, try and isolate below
      FitToPagesWide => 1,
#      FitToPagesTall => '', # False,
      PrintTitleRows => '$1:$7',
      PrintTitleColumns => '$A:$B',
      );

$Sheet->PageSetup->{'Zoom'}= "";
$Sheet->PageSetup->{'FitToPagesTall'}= "";

But I have the following error with it:

OLE exception from "Microsoft Excel":

Unable to set the Zoom property of the PageSetup class

Win32::OLE(0.1502) error 0x80020009: "Exception occurred"
    in PROPERTYPUT "Zoom" at P:\thomas_b\perlole\xlPageSetup line 48


Any idea about where the problem is ?







*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au 
titre de ce message s'il a ete altere, deforme ou falsifie.
                                ********
This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified. 

*************************************************************************

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to