View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
filo666 filo666 is offline
external usenet poster
 
Posts: 265
Default How to format cells of a column as text programmetically

Selection.NumberFormat = "@"

"DPM" wrote:

Hi,

I have got an excel with data and need to import the data into a DBF.
Therefore I use the ODBC drivers and the DBF gets created.

But found the following problem,

When data was entered into the excel initallly, the column was not formated
text and remains in general format.
Thereafter values were entered such as,
123
45.l00
1/2

Before importing using ODBC I format the entire column as Text
programmetically.
But eventhough the resulting DBF gets 0, as induvidual cells in the excel
does not get formatted, even the column is formatted.
Noticed that manually if you goto each cell in the excel and just enter, the
value gets formatted into Text and thereafter gets imported properly using
ODBC.

Could someone please advice how to format each cell in the column, to Text
programmetically, which converts the data to text.
So that data is proper when the DBF is created using ODBC.

Note:
SaveAs() of Excel2003 works fine. Excel2007 does not have SaveAs() therefore
ODBC is used above.