LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 31 Jul 2008 14:37:46 -0400
Reply-To:   Randy Herbison <RandyHerbison@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Randy Herbison <RandyHerbison@WESTAT.COM>
Subject:   Re: SAS OLE for MS Excel
Comments:   To: d-dubs <m.denniswilliams@GMAIL.COM>
In-Reply-To:   <8cdcf445-1334-441f-8ba0-ad7604486137@r66g2000hsg.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

The SAS/AF error message is caused by:

call send (rng2, '_get_property_', 'ColumnWidth', 20);

If you really want to GET the column width, use a numeric variable for the method parameter:

call send (rng2, '_get_property_', 'ColumnWidth', columnWidth);

But you wrote that you are trying to SET the column width. If that's what you want to do, use the _setProperty() method:

call send (rng2, '_set_property_', 'ColumnWidth', 20);

or as I would code it: rng2._setProperty('ColumnWidth', 20);

Declare the Excel object identifiers as type SASHELP.FSP.HAUTO to use dot notation.

-Randy

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of d-dubs Sent: Thursday, July 31, 2008 1:36 PM To: SAS-L@LISTSERV.UGA.EDU Subject: SAS OLE for MS Excel

I am trying to apply formating to a Excel file using OLE. I am able to use the font to create a bold font. But not able to change the Column Width and also the Background color. I tried creating Excel macros to do the same thing and tried to implement it in sas but I am not successful yet. Could someone help me in the syntax for ColumnWidth and BackgroundColor using "call send".

APPLYFORMATS: call send(excelobj,'_GET_PROPERTY_','ActiveSheet', wsobj ); call send (wsobj, '_get_property_', 'range', 'a1', 'cv1', rng); call send (rng, '_get_property_', 'font', font); call send (font, '_set_property_', 'FontStyle', 'Bold');

call send (wsobj, '_get_property_', 'range', 'a1','a25', rng2); call send (rng2, '_get_property_', 'ColumnWidth', 20);

return; /********************************************************************/

log:

ERROR: Invalid argument. Arguments passed to SEND: 1 rng2 = 4501 2 (Character Literal) = '_get_property_' Parameters passed to SEND ENTRY: 1 (Character Literal) = 'ColumnWidth' 2 (Numeric Literal) = 20 Program returning prematurely at line 46 AF Program: _0000001.NEW.NEW.SCL


Back to: Top of message | Previous page | Main SAS-L page