473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

CreateTextFile Excel file formetting problem

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?

Mar 24 '06 #1
1 2036
What does the ReplaceForShow() function do?

What type of data is being placed in the column?

Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: spradl | last post by:
Hi, I am trying to create a dynamic CSV file via FileSystemObject.CreateTextFile. I have no problem creating the CSV file normally but I would like to insert comments and VBScript into the...
3
by: eddie wang | last post by:
I use filesys.createTextFile to create a csv file. If I have about 600 rows(10 columns) then I can see the csv file created. But, if I have about 700 rows(10 columns still) then the csv file not...
1
by: Anchorman | last post by:
A few days ago, I upgraded my browser to the very latest version, and updated to the latest service pack on my Windows 2000 machine. Since that time, as I'm testing my ASP applications on my...
14
by: Séverine Donnay | last post by:
Hi, I develop a website on my local computer in ASP/SQL SERVER 2000 in XP PRO OS. The CreateTextFile, DeleteFile and OpenTextFile (for appending and also just for reading) functions doesn't...
2
by: NeilS | last post by:
I'm developing under IIS V5.1 and testing on an ethernet with IIS hosted on WinXPPro. I am trying to implement file-upload using a polished version of the technique published in...
3
by: WindAndWaves | last post by:
Hi Folks I am wondering if any of you has any experience with unicode files created from Access. I am using an access database to write HTML files. Now, for some of these files, I use...
4
by: Andyza | last post by:
I'm using FileSystemObject to open and write to a tab delimited text file. First, I connect to a database and select some data. Then I create the text file and insert each record in the text...
1
by: Iain Bishop | last post by:
I am trying to execute the following function which performs four tests to make sure the current environment is capable of uploading files. Test 1 completes ok, but test 2 results in the page...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.