Excel Cell Value Alignment

2003-07-11 Thread Ross Matt-QMR000
Sorry forgot to change the label

 I am  tring to align the test in the cell but  it no workie and it is
 driving me nuts 
 
   $RangeValue = J1;
   $Alignment = xlCenter;
 
   $Working_Alignment  = $Book-Worksheets($SHEET_NAME);
   $Working_Alignment
 -Range($RangeValue)-{HorizontalAlignment} = $Alignment;
 
 I get this error and I do not know why?
 
 Unable to set the HorizontalAlignment property of the Range class
 
 Win32::OLE(0.1603) error 0x80020009: Exception occurred
 in PROPERTYPUT HorizontalAlignment at
 D:/apps/XML_2_EXCEL_DRIVER/v001.004/
 Modules/proc_data.pm line 306
 
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Excel Cell Value Alignment

2003-07-11 Thread work
 Sorry forgot to change the label

 I am  tring to align the test in the cell but  it no workie and it is
 driving me nuts

   $RangeValue = J1;
   $Alignment = xlCenter;

   $Working_Alignment  = $Book-Worksheets($SHEET_NAME);
 $Working_Alignment
 -Range($RangeValue)-{HorizontalAlignment} = $Alignment;

Almost, try this:

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

my $Excel = Win32::OLE-GetActiveObject('Excel.Application') ||
   Win32::OLE-new('Excel.Application');
$Excel-{'Visible'} = 1;#0 is hidden, 1 is visible
$Excel-{DisplayAlerts}=0;#0 is hide alerts

# Open new Worksheet
$Excel-{SheetsInNewWorkBook} = 1;
my $Book = $Excel-Workbooks-Add();
my $Sheet = $Book-Worksheets(1);
$Sheet-Activate();

my $range = 'A1';

$Sheet-Range($range)-{Value} = 'abc';

$Sheet-Range($range)-Interior-{ColorIndex} = 27;
$Sheet-Range($range)-Font-{FontStyle}=Bold;
$Sheet-Range($range)-{HorizontalAlignment} = xlHAlignCenter;
$Sheet-Range($range)-Font-{Underline} = xlUnderlineStyleSingle;
# or
$Sheet-Range($range)-Font-{Underline} = 2;

sleep(5)

-- 
Nathaniel G. Bartusiak
TTMS, Keesler AFB




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