Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting to Excel 2

Status
Not open for further replies.

rissac

Technical User
May 9, 2003
79
IN
Does any know how to have fields from a table in Dreamweaver be exported into Microsoft Excel? I want to have a button that lets me take a table from dreamweaver and have it into imported into Excel, preferably in a format that is ready to print.

 
"fields from a table in Dreamweaver "
are nothing but the fields of an EMPTY table, you meant from HTML file? look into XML or just copy-paste into Excel
 
Here is a new tutorial on how to write to an Excelsheet using ASP. The result is nothing serious, but it shows the potential :)

First we set the type of script

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>

Make the object, and set the object to an Excelsheet

Dim ExcelFace
Set ExcelFace = CreateObject(&quot;Excel.Sheet&quot;)

Now lets write the rest of the script, see the comments

' show or dont show Excel to user, TRUE or FALSE
ExcelFace.Application.Visible = True
' Create the yellow face
ExcelFace.ActiveSheet.Range(&quot;F3:K25&quot;).Interior.ColorIndex = 6
' Create both the blue eyes
ExcelFace.ActiveSheet.Range(&quot;G6:G10&quot;).Interior.ColorIndex = 5
ExcelFace.ActiveSheet.Range(&quot;J6:J10&quot;).Interior.ColorIndex = 5
' Create a purple nose
ExcelFace.ActiveSheet.Range(&quot;H13:I18&quot;).Interior.ColorIndex = 29
' create a red mouth
ExcelFace.ActiveSheet.Range(&quot;G21:J24&quot;).Interior.ColorIndex = 3
' Write the text
ExcelFace.ActiveSheet.Cells(1,1).Value = &quot;Now isnt this fun :) &quot;
' Save the the excelsheet to excelface
ExcelFace.SaveAs &quot;c:\excelface.xls&quot;
' Close Excel with the Quit method on the Application object.
ExcelFace.Application.Quit
' Release the object variable.
Set ExcelFace = Nothing
%>


Now lets complete the HTML tags.

<HTML>
<HEAD>
<TITLE>Excelface</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

This completes yer ASP page, look below for the complete code of excelface.asp

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<%
' Create Object
Dim ExcelFace
Set ExcelFace = CreateObject(&quot;Excel.Sheet&quot;)
' show or dont show excelto user, TRUE or FALSE
ExcelFace.Application.Visible = True
' Create the yellow face
ExcelFace.ActiveSheet.Range(&quot;F3:K25&quot;).Interior.ColorIndex = 6
' Create both the blue eyes
ExcelFace.ActiveSheet.Range(&quot;G6:G10&quot;).Interior.ColorIndex = 5
ExcelFace.ActiveSheet.Range(&quot;J6:J10&quot;).Interior.ColorIndex = 5
' Create a purple nose
ExcelFace.ActiveSheet.Range(&quot;H13:I18&quot;).Interior.ColorIndex = 29
' create a red mouth
ExcelFace.ActiveSheet.Range(&quot;G21:J24&quot;).Interior.ColorIndex = 3
' Write the text
ExcelFace.ActiveSheet.Cells(1,1).Value = &quot;Now isnt this fun :) &quot;
' Save the the excelsheet to excelface
ExcelFace.SaveAs &quot;c:\excelface.xls&quot;
' Close Excel with the Quit method on the Application object.
ExcelFace.Application.Quit
' Release the object variable.
Set ExcelFace = Nothing
%>
<HTML>
<HEAD>
<TITLE>Excelface</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

[tt]Nothing in life is to be feared. It is only to be understood
 
Excellent post, thanks! (I'm not the OP -- it's just that this is really useful -- I've always created comma- or tab-delimited files and imported them into Excel, but this is much better. Star indeed!)
 
WOW, got a star on my first post. Thank you Genimuse.

Reason I signed up was to give back...

[tt]Nothing in life is to be feared. It is only to be understood
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top