View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Salty Dog[_2_] Salty Dog[_2_] is offline
external usenet poster
 
Posts: 6
Default OpenText looses leading zeros for zip

If you manually right-click and format cell and save/click OK, then when you
go back to right-click the cell it will show the new formatting.

If I programmitically set the formatting then by right-clicking cells
format cells does not show that the cell is formatted as text.

Thanks!

"Tom Ogilvy" wrote:

Formatting does not change arbitrarily. Also, formatting a column after the
data is already there does nothing to the existing data. The zero is gone
at that time. It would be interesting to know how you determine if the
formatting is still there or not. Looking at it is not the correct answer.



--
Regards,
Tom Ogilvy

"Salty Dog" wrote in message
...
I appreciate the help but my file already has a .txt extension, I have
international postal codes so the fixed format does not apply, and I have
tried the OpenText FieldInfo settings. The code does not error when I
formatnumber="@", but the column does not appear/stay formatted as text.
Same with the OpenText FieldInfo try. Thanks!

"Tom Ogilvy" wrote:

If a CSV, OpenText doesn't pay any attention to you settings. Change

the
name of the file to have a .txt extension and use the settings in

OpenText
to tell excel to treat that column as Text.

If you can't get that to work, you can format the column as

objExcel.ActiveWorkbook.Activesheet.Columns("L").N umberFormat = "00000"

or loop through each cell and do something like

cell.Vaue = "'" & Right("00000" & cell.Value,5)

--
Regards,
Tom Ogilvy

"Salty Dog" wrote in message
...
I've tried
objExcel.ActiveWorkbook.Activesheet.Columns("L").N umberFormat = "@"
and no luck.

I also tried the FieldInfo Array of Arrays for OpenText.

I'm using vbs and I'm looking for a way to not loose leading zeros?
Thanks!