ActiveWeb Property Example

This example uses the ActiveWeb property to locate the web page index.htm and changes the background color of the web page.

Note   To run this example, create a form with one command button called cmdActiveWebColorChange and paste the following code in the code window. You must have a web page called index.htm for this procedure to change the background color.

Private Sub cmdActiveWebBKGRDColorChange_Click()
Dim myPageWin As PageWindow

Set myPageWin = Application.ActiveWeb.LocatePage("index.htm")

myPageWin.Document.bgColor = "PapayaWhip"

End Sub

Note   Microsoft Visual Basic for Applications provides color constants with a "vb" prefix, such as vbCyan. FrontPage builds Web pages in HTML, which uses different color constants than Visual Basic. If you use the color constants provided with Visual Basic in your existing programs, you may need to change these to the equivalent hexadecimal color values when you port your programs to a FrontPage-based web, or when you use colors across Office applications that include a FrontPage-based web.