esthera
10-30-2007, 07:56 AM
i create an excel from asp using the file system object
my problem is there is a collumn with numbers such as
00552222222
all with 0's first. when i open the excel it removes the 0's in the collumn -- any suggestions to force it as a string in excel and not a number
BarrMan
10-30-2007, 06:04 PM
When you created the Excel database. Did you set those fields to be integer?
esthera
10-30-2007, 06:26 PM
no
i just do
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set MyFile = fs.CreateTextFile(filename, True)
Set rs = objconns.Execute(sql)
strLine="<table><tr>" 'Initialize the variable for storing the filednames
For each x in rs.fields
strLine= strLine & "<td>" & x.name & "</td>"
Next
strline=strline&"</tr>"
MyFile.writeline strLine
Do while Not rs.EOF
strLine="<tr>"
for each x in rs.Fields
cell=x.value
strLine= strLine & "<td>" & cell & "</td>"
next
strline=strline & "</tr>"
'response.write strline & vbcrlf
MyFile.writeline strLine
rs.MoveNext
Loop
myfile.writeline "</table>"
MyFile.Close
Set MyFile=Nothing
Set fs=Nothing
Spudhead
10-31-2007, 01:35 PM
That's not an Excel file :confused: That's a HTML table.
Put quotes round values for them to be parsed as strings.