Thread: exporting data
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ernst Guckel[_4_] Ernst Guckel[_4_] is offline
external usenet poster
 
Posts: 34
Default exporting data

Hello,

I am trying to export data to a text file... The problem is that the data
needs to be loaded as a string to preserve leading zeros but when i "Write"
the data to the file it puts "s in the data file...

Here is some code:
Dim c As Range
Dim intTemp As Variant
Dim strFileName As String
strFileName = "C:\FoodCost.Dat"
Open strFileName For Output As #1 ' Open file for output.

For Each c In Range("ItemRange")

intTemp = c.Cells(1, 8).Value
If c.Cells(1, 8).Value = "" Then GoTo NextItem

Write #1, CDec(intTemp)


NextItem:
Next
Close #1 ' Close file.

Here is an exerpt of the file:

"0000000367"
"0010000408"
"0030000588"
"0040000670"

the #s have to be 10 digits with leading 0s... any help would be great...

Ernst.