In This Site

Home
Free News Updates
Using Microsoft FrontPage
Cascading Style Sheets
Database Fundamentals
FrontPage & Access
FrontPage Navigation
Website Security
Solving Problems
Learning SQL
Code Samples
Promote Your Site

In This Section

Format Numeric Fields
Missing Memo Line Breaks
Dealing with Blank Data
Dynamic Column Sorting
Create Bar Charts
Use Multiple Columns
View Results in Excel

The number one source for making your website sell!

 

Take Your Web Site to New Levels

View your Database Results in Microsoft Excel

FrontPage excels at compiling database results and displaying them in your browser. On occasion, you want the data displayed in other programs, Microsoft Excel for instance.

As an example, I've created a small database results page that uses the Northwind database. Using the Response Object you can tell Internet Explorer to display the page using other Microsoft Office programs.

Click here to view it now. Be patient, this can take several minutes to open. It may seem like your browser has frozen but rest assured the page WILL open.

This is accomplished simply by adding a little code to the page. On a blank page select Insert-Database-Results. Place a database region that will display the data you would like to analyze in Excel. Save the page as Excel.asp and preview it in your browser. Once you can serve the page correctly you are ready to alter it so that the page will open in Excel.

Switch the page to HTML view and look for the first <html> tag. Place the following code above this tag so it looks like the following:

<%Response.Buffer = True%>
<%Response.ContentType="Application/vnd.ms-excel"%>
<html>

This code buffers your html and then tells Internet Explorer to display the page using Microsoft Excel rather than Internet Explorer.

Near the bottom of the page, look for the following code:

</table>
</body>

and change it to the following:

</table>
<%Response.end%>
</body>

This ends the html code immediately after the table. Save the page and open it in Internet Explorer. You will be presented with a dialog that resembles the following:

You have the option of either saving your page as an Excel file OR opening it in Excel. Click the Open button and your browser will open with the table loaded. At first glance, It may not appear that the page has opened in excel, but what really happens is that Internet Explorer's menus change to Excel's menus. At any point you can select File-Save As and save the page to your hard disk as in Excel format.

Why Not Open Your Page In Microsoft Word?

With only a minor change, you can choose to open your table in Word rather than Excel. Follow the same process outlined above, but change your Response Object code to the following:

<%Response.Buffer = True%>
<%Response.ContentType="Application/msword"%>
<html>

You'll still need to add the following code to end your html:

</table>
<%Response.end%>
</body>

And you're done. Save the page as word.asp and check it out. Click here to view word.asp now

All it takes is a little FrontPage Magic.


These tutorials are part of an upcoming training course called "FrontPage Magic - How To Create A Database Driven Website For Non-Programmers". Stay tuned for more details on this exciting new product.

Send your tips to .
All materials Copyright © Ward Cameron All Rights Reserved