Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel automation and cell formatting
Message
From
23/08/2011 14:27:51
 
 
To
23/08/2011 13:52:38
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01521605
Message ID:
01521627
Views:
51
>>>>Hi All,
>>>>
>>>>I am using Excel automation to populate some cells with data. How can I tell Excel to format a cell as character before sending through the data?
>>>>
>>>>Thanks
>>>
>>>Hi. What Sergey states is what I usually do, too. Another alternative is to FIRST change the cell format to Text, THEN insert the value.
>>
>>OK, how do I change the cell format to text first ?
>
>In Excel, the shortcut to access cell format is Ctrl-1. From the tab "Number", choose "Text".
>
>The macro recorder shows:
>
>
>Selection.NumberFormat = "@"
>
>
>So that would probably translate to something like:
>
>
>oSheet.Cells(nrow, ncol).NumberFormat = "@"
>
>
>or for a larger range:
>
>
>oSheet.Range(oSheet.Cells(1,1), oSheet.Cells(100,1)).NumberFormat = "@"
>
Thanks Hilmar, that does the trick.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Reply
Map
View

Click here to load this message in the networking platform