Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Export to Word from ASP

AZZA-KHAMEESFlag for Bahrain asked on
ASPHTMLScripting Languages
4 Comments1 Solution579 ViewsLast Modified:
Hi Experts
i am working in an old application developed using classic ASP and VB, i am trying to export an HTML table from an asp page to word, i searched the internet for this and i found a good code that its working perfectly, he problem is that it export the whole page to word, i need to export only a part of the page which is the <table></table>

<%@ Language=VBScript %>
Option Explicit
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "Content-Disposition", "attachment; filename = MyDoc.doc"
Dim Conn,strSQL,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("shotdev/mydatabase.mdb"),"" , ""
strSQL = "SELECT * FROM customer "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
<table width="600" border="1">
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
While Not objRec.EOF
<td><div align="center"><%=objRec.Fields("CustomerID").Value%></div></td>
<td><div align="center"><%=objRec.Fields("CountryCode").Value%></div></td>
<td align="right"><%=objRec.Fields("Budget").Value%></td>
<td align="right"><%=objRec.Fields("Used").Value%></td>
Set objRec = Nothing
Set Conn = Nothing
can you please help me to solve this issue thank you
the link to the code
How to use ASP & Word Response.ContentType