Microsoft Excel Training Videos

Saving and publishing a Microsoft Excel document as a web page using a macro


Saving a document as a Web page is the process of creating and saving an HTML file and any supporting files. To do this, use the SaveAs method, as shown in the following example and training video, which saves the active workbook as C:\WebPublish\webpublish.htm.
ActiveWorkbook.SaveAs _
Filename:="C:\Webpublish\webpublish.htm", _
FileFormat:=xlHTML
You can also save the files directly to a Web server provided you have access to the server. The following example saves a range to a Web server, giving the Web page the URL address ftp://www.familycomputerclub.com/webpublish.htm.
Sub WebPublish()
ActiveWorkbook.SaveAs Filename:= _
"C:\WebPublish\dkttest.htm", _
FileFormat:=xlHtml
ActiveWorkbook.Save
With ActiveWorkbook. _
PublishObjects.Add(xlSourceSheet, _
"ftp://familycomputerclub.com/dkttest.htm", _
"Sheet1", "", xlHtmlStatic) .Publish (True)
End With
End Sub


Custom Search

Microsoft Excel Training Videos