Save as Web Page...

Home Search Site Map

Up
Close
Exit
File Search...
Most Frequently Used
New...
Open...
Page Setup...
Permission
Print...
Print Area
Print Preview
Properties
Save
Save As...
Save as Web Page...
Save Workspace...
Send To
Web Page Preview

New! Excel User Group Now Open @ www.excelusergroup.org, Check It Out!


Menu command Type What happens next?
Save as Web Page... ...

Since Excel 2000 it has been possible to save and read HTML directly into and out-of Excel. In effect HTML has been built into the native file structure.  Taking this option allows you to do one of three main things. (all via the 'Save as web page dialog' presented here).

  1. Save a pre-selected range as an HTML file (web page).

  2. Save the entire workbook, with sheet tabs, as an HTML file, (web page).

  3. Save the worksheet, chart, pivot table with 'interactivity', (a selection from the dialog), which saves the Spreadsheet 'web component'.  This option makes the web page look, feel and act like a live spreadsheet, not just a flat HTML document. This is demonstrated here and requires you have Office Web Components (OWC), which ship with Excel 2000 SP1 an up. You must also have Internet Explorer 5.01 installed

As you would expect, you have the ability, under all these options, to set the title for the page, publish it directly to a local drive, intranet or the internet and have it update automatically each time the file is saved via the 'Publish...'button.

VBA

Save a workbook as HTML (web page) without interactivity.

Sub wbSaveAsHTML()
Dim wb As Workbook
Set wb = ActiveWorkbook
'Do what you want with workbook here, using wb variable
'Then save the workbook as an html document
wb.SaveAs Filename:="C:\myWebPage.htm", FileFormat:=xlHtml
End Sub

Save a workbook range (A1:A6) as a HTML (web page) without interactivity.

Sub wbRangeAsWeb()
Dim wb As Workbook
Set wb = ActiveWorkbook
'Do what you want with workbook here, using wb variable
'Then save the range A1:C6 as an html document without interactivity
With wb.PublishObjects.Add(xlSourceRange, _
"C:\myPage.htm", "Sheet1", "$A$1:$C$6", _
xlHtmlStatic, "Book1_20936")
.Publish (True)
End With
End Sub

Save a workbook range (A1:A6) as a web component with interactivity. (Note the change from xlHtmlStatic (above) to xlHtmlCalc (Below). This adds the interactivity.

Sub wbRangeAsDynamicWeb()
Dim wb As Workbook
Set wb = ActiveWorkbook
'Do what you want with workbook here, using wb variable
'Then save the range A1:C6 as an web component with interactivity
With wb.PublishObjects.Add(xlSourceRange, _
"C:\myPage.htm", "Sheet1", "$A$1:$C$6", _
xlHtmlCalc, "Book1_20936")
.Publish (True)
End With
End Sub

Top

Copyright Nick Hodge 2008. All Rights Reserved.