syntax WriteLine on generating file

i'm need to create xls file:

Dim file_being_created,fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
file_being_created= Server.MapPath("text.xls")
Set act = fso.CreateTextFile(file_being_created, true)
 
 
act.WriteLine("<html><body>")
act.WriteLine("<table border=""1"">")
act.WriteLine("<tr>")
act.WriteLine("<th nowrap>State</th>")
act.WriteLine("<th nowrap>Abbreviaton</th>")
act.WriteLine("</tr>")
 
 
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">California</td>" )
act.WriteLine("<td align=""right"">CA</td>" )
act.WriteLine("</tr>")
 
act.WriteLine("<tr>")
act.WriteLine("<td align=""right"">Ohio</td>" )
act.WriteLine("<td align=""right"">OH</td>" )
act.WriteLine("</tr>")
 
 
act.WriteLine("</table></body></html>")
 
' close the object (excel)
act.close


but my real report code is written out of <% %>
means look like html...and when come a plaxe for asp i just open the <%
and closing it again...

is there a way to avoid rewriting all the code into the  
act.WriteLine("???")

can't i jus open is some how one time  
act.WriteLine("
///
and close it after all my code endes?
sasha85Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GawaiCommented:
no but u can use this way offcourse


act.WriteLine("<html><body><table border=""1""><tr><th nowrap>State</th><th nowrap>Abbreviaton</th></tr>")

Open in new window

Ashish PatelCommented:
Try this


Dim file_being_created,fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
file_being_created= Server.MapPath("text.xls")
Set act = fso.CreateTextFile(file_being_created, true)
Dim htmlstr 
 
htmlstr = ""
htmlstr = htmlstr & "<html><body>"
htmlstr = htmlstr & "<table border=""1"">"
htmlstr = htmlstr & "<tr>"
htmlstr = htmlstr & "<th nowrap>State</th>"
htmlstr = htmlstr & "<th nowrap>Abbreviaton</th>"
htmlstr = htmlstr & "</tr>"
 
 
htmlstr = htmlstr & "<tr>"
htmlstr = htmlstr & "<td align=""right"">California</td>" 
htmlstr = htmlstr & "<td align=""right"">CA</td>" 
htmlstr = htmlstr & "</tr>"
 
htmlstr = htmlstr & "<tr>"
htmlstr = htmlstr & "<td align=""right"">Ohio</td>" 
htmlstr = htmlstr & "<td align=""right"">OH</td>"
htmlstr = htmlstr & "</tr>"
 
 
htmlstr = htmlstr & "</table></body></html>"
 
act.WriteLine(htmlstr)
' close the object (excel)
act.close

Open in new window

GawaiCommented:
wow nice one but still there is repetation of htmlstr and file size also increased 792 bytes to 913 bytes
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

GawaiCommented:
sory type i mean repetition  
sasha85Author Commented:
still...it come's with code on the side...i understand that there is no other way then...
Ashish PatelCommented:
Right sasha85 Other than these options there are no work around for saving files.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sasha85Author Commented:
i am going to rewrite 142 rows then...it will be very ugly...my notepad wont like this...:)
Ashish PatelCommented:
can you paste your 142 rows here? May be i cna help you get it quickly and also will show you how to do that very quickly
PaulHewsCommented:
It's unclear from the question why you are saving this text file.  It only really makes sense if it contains dynamic data.  What is the source of the data?
WylkellCommented:
If your looking to take some raw text and wrap it around HTML or XML tags via vbscript, your only other option (beyond mass copy/paste's inside notepad) would probably be to write your code to take a text file and put your tags around it.  it sorta depends on what your trying to accomplish in the end.

If your just trying to take some raw text and throw it into HTML with pretty fonts and tables and the like, then your probably better off doing this in MS Office.  Unless this is something your trying to do that needs to be run daily or something...
sasha85Author Commented:
i got it all going with office...but i bump into a problem that i havn't thought about..
how can i insert asp codes and functions...if else for while...into act.WriteLine("
?
sasha85Author Commented:
how can i put asp code inside the act.WriteLine?
WylkellCommented:
I would think you should still be able to put asp code inside of your writeline statement, as long as it's all encapsulated by the double quotes and that you watch for double quotes within the strings.  the script will treat it like a series of strings, which is what you would want.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.