CreateTextFile Excel file formetting problem

C

clemorama

Hi All,
I am having problems with serving an excel file to client web browsers.
I am creating a tab delimited .xls from a recordset. Below is the .asp
code.

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConn
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "sp_GetProviderPayments @StartDate='" & strStartDate &
"',@EndDate='" & strEndDate & "'"
objRS.Open strSQL,objConn
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
strPath = "C:\Web Projects\docs\"
strFileName = DatePart("m",strStartDate) & DatePart("d",strStartDate) &
DatePart("yyyy",strStartDate) & "_" & _
DatePart("m",strEndDate) & DatePart("d",strEndDate) &
DatePart("yyyy",strEndDate) & ".xls"
Set objLogFile = objFSO.CreateTextFile(strPath &
strFileName,true,false)

objLogFile.Write "Date" & vbTab
objLogFile.Write "Amount" & vbTab
objLogFile.Write "Provider" & vbTab
objLogFile.Write "Primary Name" & vbTab
objLogFile.Write "Child Name" & vbTab
objLogFile.Write "Case Manager" & vbTab
objLogFile.Write "Accounting CreatedBy" & vbTab
objLogFile.Write "Accounting Date Created"
objLogFile.WriteLine
While NOt objRS.EOF
objLogFile.Write CHR(34) & Trim(objRS("DDate")) & CHR(34) & vbTab
objLogFile.Write CHR(34) & Trim(objRS("Total")) & CHR(34) & vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("ProName")) & CHR(34)
& vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("PName")) & CHR(34) &
vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("CName")) & CHR(34) &
vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("uName")) & CHR(34) &
vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("CreatedBy")) &
CHR(34) & vbTab
objLogFile.Write CHR(34) & ReplaceForShow(objRS("CreatedDate")) &
CHR(34)
objLogFile.WriteLine
objRS.MoveNext
Wend
Set objLogFile = nothing
Set objFSO = nothing
Set objRS = nothing
Set objConn = nothing

The weird thing is that the file looks fine when I open it on the web
server but for some reason when I open the file from my web application
objRS("CName") and objRS("UName") are in the same column separated by a
".

Any suggestions?
 
S

Scott

What does the ReplaceForShow() function do?

What type of data is being placed in the column?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top