Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel
Message
From
14/01/2005 10:55:34
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
 
 
To
13/01/2005 19:35:27
Maltin Lacsina
Angeles Electric Corporation
Angeles, Philippines
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Re: Excel
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
00977010
Message ID:
00977215
Views:
23
>How can I format a entire column of excel using vfp?
>For example when I put a numeric value in a cell it get a cell money format.

For the following examples, assume the following:
oExcel = Instance of Excel in VFP
lcWorkbookName = The stem of the file name
lcWorksheetName = The name of the worksheet

The format will be Dollar with two decimals
To format all of column "C":
oExcel.Workbooks(lcWorkbookName).Worksheets(lcWorksheetName).Columns("C").NumberFormat = "$#,##0.00"

To format all of Row 4:
oExcel.Workbooks(lcWorkbookName).Worksheets(lcWorksheetName).Rows(4).NumberFormat = "$#,##0.00"

To format a the range A17 to C30
oExcel.Workbooks(lcWorkbookName).Worksheets(lcWorksheetName).Range("A17:C30").NumberFormat
The RANGE() property also takes RANGE(CELLS(x,y), CELLS(x,y)) if you don't know the letter of the column
Previous
Reply
Map
View

Click here to load this message in the networking platform