Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Format a column in Excel
Message
From
02/10/2003 10:12:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
02/10/2003 10:05:07
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00834243
Message ID:
00834249
Views:
36
>I am using VFP8 to output a cursor into Excel.
>
>How can I format a column in Excel to force all data to be left justified or as character type data?
>
>The problem I am having is that field2 of my cursor is a character field but it can contain either characters(abc), numbers(123) or both(abc123). When I output the data to Excel, the second column will left justify the character data and right justify the number data.
>
>I am doing the following to output the data.
>
>oSheet = CreateObject("Excel.Sheet.8")
>lnRow = 1
>SCAN
>oSheet.ActiveSheet.Cells(lnRow, 1).Value = mycursor.field1
>oSheet.ActiveSheet.Cells(lnRow, 2).Value = mycursor.field2
>lnRow = lnRow + 1
>ENDSCAN
>
With Automation, you can format the cell as text before inserting a value.

>I'm not using the COPY TO file TYPE XL5 because the cursor's field names are outputted on the first row of the spreadsheet and we don't want to see the field names.

That's no excuse, IMHO. It would be much faster to COPY TO ..., and then to erase the first row through Automation.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform