Exploring the Page Object Model in FrontPage

The Page object model contains constants, events, methods, objects, and properties for FrontPage document objects that are compatible with Microsoft Internet Explorer 4.0 and later. These programming elements generally follow the model used in Internet Explorer. General usage for objects for those who are familiar with Internet Explorer is to prefix the object name with an "FP." For example, the object name for the FPHTMLDocument object in FrontPage is "HTMLDocument" in InternetExplorer.

Note In many cases the "IHTML" object has been retained for the convenience of devleopers familiar with Internet Explorer.

Click the one of the following links to see detailed information for a specific topic.

Events

Methods

Objects

Properties

Visit the Office Developer Center at MSDN Online for the latest Microsoft FrontPage development information, including new technical articles, downloads, samples, product news, and more.


HTML Events Supported by Microsoft FrontPage 2002

The events in the Microsoft FrontPage Page object model are based on the events in Microsoft Internet Explorer 4.0. Click any of the links in the following list for more detailed information on the specified event.

onbeforeunload

onblur

onchange

onclick

ondblclick

ondragstart

onfocus

onkeydown

onkeypress

onkeyup

onload

 onmousedown

onmousemove

onmouseout

onmouseover

onmouseup

onreadystatechange

onresize

onscroll

onselect

onselectstart

onunload

Note The FrontPage Page Object Model Help refers to objects, methods, properties and events that are defined in the Internet Explorer 4.0 dynamic HTML Help file (HTMLRef.chm). The examples and remarks given in this Help file were originally created for use with the JavaScript programming language. There are some differences between the JavaScript language and Microsoft Visual Basic. For example, HTMLRef.chm mentions checking for NULL when a property or method returns an object that does not exist. This is incorrect for Visual Basic. In the Visual Basic Language, the type Nothing is returned in this case. Visual Basic users can check an object for Nothing by using the Is keyword.

For example,

If MyObject Is Nothing Then

Also, many of the examples are given in JavaScript instead of Visual Basic. JavaScript is similar to the C++ language in structure and format.

The following is an example ofJavaScript.

var Table = document.all.tags("table").item(0);
var TableCell = table.rows(3).cells(2);
TableCell.innertext = ""
While (p != NULL)
{
    TableCell.innerText = p.tagName;
    var p = p.parentElement
    TableCell.innertext = p.tagName;
    TableCell.innertext += "+";
    TableCell.innertext += TableCell.innertext;
}

The following is the equivalent example in Visual Basic.

Sub SetText()

  Set TableCell = table.Rows(3).Cells(2)
  Set p = TableCell
  TableCell.innerText = ""
  Do While Not p Is Nothing
    TableCell.innerText = p.tagName & "+" & TableCell.innerText
    Set p = p.parentElement
  Loop

End Sub


HTML Events not Supported by FrontPage 2002

The events listed in the following table are not supported in this version of Microsoft FrontPage.

onabort | ondatasetcomplete | onhelp
Onafterupdate | onerror | onreset
onblur (Elements) | onerrorupdate | onrowenter
onbounce | onfilterchange | onrowexit
ondataavailable | onfinish | onstart
ondatasetchanged | onfocus (Elements) | onsubmit


FrontPage-Specific Methods

The following methods are specific to FrontPage. Click a topic in the list for a detailed description of that topic.


HTML Methods Supported in FrontPage 2002

The methods in Microsoft FrontPage Page object model are based on the events in Microsoft Internet Explorer 4.0. Click any of the links in the following list for more detailed information on the specified method.

Note Some of the methods have more than one topic associated with it.

Note For information on the IFPStyleState object and its methods, see FrontPage Programmability Items. This hyperlink goes to the web. You can switch back to help at any time.
add (Areas)

addImport

addRule

alert

clear

collapse

compareEndPoints

confirm

contains

createCaption

createElement

createRange

createStyleState

createTextRange

createTFoot

createTHead

deleteCaption

deleteCell

deleteRow

deleteTFoot

deleteTHead

duplicate

elementFromPoint

empty

execCommand

expand

findText

focus (IHTMLWindow2)

getAttribute

getAttribute (userProfile)

getBookmark

inRange

insertAdjacentHTML

insertAdjacentText

 insertCell

insertRow

isEqual

item (All Except IHTMLControlRange, IHTMLFilters)

move

moveEnd

moveStart

moveToBookmark

moveToElementText

moveToPoint

parentElement

pasteHTML

prompt

queryCommandEnabled

queryCommandIndeterm

queryCommandState

queryCommandSupported

queryCommandValue

reload

remove (IHTMLAreas)

removeAttribute

removeRule

scrollIntoView

select (IHTMLtxtRange)

setAttribute

tags

Note The FrontPage Page Object Model Help refers to objects, methods, properties and events that are defined in the Internet Explorer 4.0 dynamic HTML Help file (HTMLRef.chm). The examples and remarks given in this Help file were originally created for use with the JavaScript programming language. There are some differences between the JavaScript language and Microsoft Visual Basic. For example, HTMLRef.chm mentions checking for NULL when a property or method returns an object that does not exist. This is incorrect for Visual Basic. In the Visual Basic Language, the type Nothing is returned in this case. Visual Basic users can check an object for Nothing by using the Is keyword.

For example,

If MyObject Is Nothing Then

Also, many of the examples are given in JavaScript instead of Visual Basic. JavaScript is similar to the C++ language in structure and format.

The following is an example ofJavaScript.

var Table = document.all.tags("table").item(0);
var TableCell = table.rows(3).cells(2);
TableCell.innertext = ""
While (p != NULL)
{
    TableCell.innerText = p.tagName;
    var p = p.parentElement
    TableCell.innertext = p.tagName;
    TableCell.innertext += "+";
    TableCell.innertext += TableCell.innertext;
}

The following is the equivalent example in Visual Basic.

Sub SetText()

  Set TableCell = table.Rows(3).Cells(2)
  Set p = TableCell
  TableCell.innerText = ""
  Do While Not p Is Nothing
    TableCell.innerText = p.tagName & "+" & TableCell.innerText
    Set p = p.parentElement
  Loop

End Sub


HTML Methods not Supported by FrontPage 2002

The methods shown in the following list are not supported in this version of Microsoft FrontPage.

Remarks

Unlike Microsoft Internet Explorer 4.0, you can add or modify the contents of the <Head></Head> tags in HTML. Instead of creating a style sheet, you can use the insertAdjacentHTML method to add <Style></Style> tags in the contents of the <Head></Head> tags for your page.

add (IHTMLControlRange, IHTMLSelectElement) | execCommandShowHelp | reset
addFilter | execScript | resizeBy
addReadRequest | focus(All Except IHTMLWindow2) | resizeTo
addRequest | forward | scroll
assign | go | scrollBy
back | IsNameUnique | scrollTo
blur | item(IHTMLControlRange, IHTMLFilters) | select (All Except IHTMLtxtRange)
clear (IHTMLDocument2) | javaEnabled | setInterval
clearInterval | moveBy | setTimeout
clearRequest | moveTo | showHelp
clearTimeout | navigate | showModalDialog
click | nextPage | start
close | open (Window) | Stop
commit (PostFiles) | previousPage | submit
commitChanges | prompt | taintEnabled
createControlRange | Refresh | toString
createStyleSheet | reload | UsesDataBaseServices
doReadRequest | remove (IHTMLControlRange, IHTMLSelectElement) | write
doRequest | removeFilter | writeln
doWriteRequest | replace |


FrontPage-Specific Objects

The following objects are FrontPage-specific objects. To view detailed information about these objects, click a hyperlink in the list.

IFPDocument Object

UndoTransaction Object

IHTMLFrontPageBotElement


HTML Objects in Microsoft FrontPage 2002

The Microsoft FrontPage object model consists of three separate object models—the Application object model, the Web object model, and the Page object model that is based on Microsoft Internet Explorer 4.0's Document object model.

In FrontPage, the objects in the Page object model are prefaced with an “FP” and take on the form "FPHTMLobject_name" or "IHTMLobject_name" while the objects in Internet Explorer have the form "HTMLobject_name" and "IHTMLobject_name". For example, if you want to reference the IHTMLDocument2 object in FrontPage, you would use “FPHTMLDocument.” Click any of the links in the following tables for more detailed information on the specified object.

Note For more information about individual objects, consult The Microsoft Developer Network.

FPHTML Programming Elements
FPHTMLAnchorElement

FPHTMLAreaElement

FPHTMLBaseFontElement

FPHTMLBGsound

FPHTMLBlockElement

FPHTMLBody

FPHTMLButtonElement

FPHTMLCommentElement

FPHTMLDDElement

FPHTMLDialog

FPHTMLDivElement

FPHTMLDivPosition

FPHTMLDListElement

FPHTMLDocument

FPHTMLDTElement

FPHTMLEmbed

FPHTMLFieldSetElement

FPHTMLFiltersCollection

FPHTMLFontElement

FPHTMLFormElement

FPHTMLFrameBase

FPHTMLFrameElement

FPHTMLFrameSetSite

FPHTMLHeaderElement

FPHTMLHRElement

FPHTMLIFrame

FPHTMLImageElementFactory

FPHTMLImg

FPHTMLInputButtonElement

FPHTMLInputFileElement

FPHTMLInputHiddenElement

FPHTMLInputImage

FPHTMLInputTextElement

FPHTMLIsIndexElement

FPHTMLLabelElement

FPHTMLLegendElement

FPHTMLLIElement

 FPHTMLLinkElement

FPHTMLListElement

FPHTMLLocation

FPHTMLMapElement

FPHTMLMarqueeElement

FPHTMLMetaElement

FPHTMLNextIdElement

FPHTMLNoShowElement

FPHTMLObjectElement

FPHTMLOListElement

FPHTMLOptionButtonElement

FPHTMLOptionElement

FPHTMLOptionElementFactory

FPHTMLParaElement

FPHTMLPhraseElement

FPHTMLScreen

FPHTMLScriptElement

FPHTMLSelectElement

FPHTMLSpanElement

FPHTMLSpanFlow

FPHTMLStyle

FPHTMLStyleElement

FPHTMLStyleSheet

FPHTMLStyleSheetsCollection

FPHTMLTable

FPHTMLTableCaption

FPHTMLTableCell

FPHTMLTableCol

FPHTMLTableRow

FPHTMLTableSection

FPHTMLTextAreaElement

FPHTMLTextElement

FPHTMLTitleElement

FPHTMLUListElement

FPHTMLUnknownElement

FPHTMLWindow2

IHTML Programming Elements
IHTMLAreasCollection

IHTMLBaseElement

IHTMLBodyElement

IHTMLButtonElement

IHTMLBRElement

IHTMLControlElement

IHTMLDatabinding

IHTMLDocument2

IHTMLElement

IHTMLElementCollection

IHTMLEmbedElement

IHTMLEventObj

 IHTMLFrameElement

IHTMLFramesCollection2

IHTMLFrameSetElement

IHTMLImgElement

IHTMLRuleStyle

IHTMLSelectionObject

IHTMLStyleSheetRule

IHTMLStyleSheetRulesCollection

IHTMLTextContainer

IHTMLTxtRange

Other Programming Elements
DispFPHTMLDocument

IFPStyleLength

IFPStyleState

IFrontPageHostedControl2

Note The FrontPage Page Object Model Help refers to objects, methods, properties and events that are defined in the Internet Explorer 4.0 dynamic HTML Help file (HTMLRef.chm). The examples and remarks given in this Help file were originally created for use with the JavaScript programming language. There are some differences between the JavaScript language and Microsoft Visual Basic. For example, HTMLRef.chm mentions checking for NULL when a property or method returns an object that does not exist. This is incorrect for Visual Basic. In the Visual Basic Language, the type Nothing is returned in this case. Visual Basic users can check an object for Nothing by using the Is keyword.

For example,

If MyObject Is Nothing Then

Also, many of the examples are given in JavaScript instead of Visual Basic. JavaScript is similar to the C++ language in structure and format.

The following is an example ofJavaScript.

var Table = document.all.tags("table").item(0);
var TableCell = table.rows(3).cells(2);
TableCell.innertext = ""
While (p != NULL)
{
    TableCell.innerText = p.tagName;
    var p = p.parentElement
    TableCell.innertext = p.tagName;
    TableCell.innertext += "+";
    TableCell.innertext += TableCell.innertext;
}

The following is the equivalent example in Visual Basic.

Sub SetText()

  Set TableCell = table.Rows(3).Cells(2)
  Set p = TableCell
  TableCell.innerText = ""
  Do While Not p Is Nothing
    TableCell.innerText = p.tagName & "+" & TableCell.innerText
    Set p = p.parentElement
  Loop

End Sub


FrontPage-Specific Properties

The following properties are specific to FrontPage. Click a topic in the list for a detailed description of that topic.


HTML Properties Supported by FrontPage 2002

The properties in Microsoft FrontPage Page object model are based on the properties in Microsoft Internet Explorer 4.0. Click any of the links in the following table for more detailed information on the specified property.

Note Some of the properties have more than one topic associated with it. For more information about individual properties, consult The Microsoft Developer Network.

Note For information on the IFPStyleState object and its properties, see FrontPage Programmability Items. This hyperlink goes to the web. You can switch back to help at any time.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
accessKey action activeElement align (Text) align (Caption) align (Table) align (Table) aLink alinkColor all | alt altHtml altKey anchors appCodeName appName applets appVersion areas
 | Return to top
background (Attributes) background (Picture) background (Table Picture) backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat balance BaseHref behavior bgColor (Element) bgColor (Page) bgProperties body border border (Style) border (Frames) border (Width) borderBottom | borderBottomColor borderBottomStyle borderBottomWidth borderColor (Element) borderColor (borderWidth and borderStyle) borderColorDark borderColorLight borderLeft borderLeftColor borderLeftStyle borderRight borderRightColor borderRightStyle borderRightWidth borderStyle borderTop borderTopColor borderTopStyle borderTopWidth borderWidth bottomMargin button
 | Return to top
cancelBubble caption cellIndex cellPadding cells cellSpacing charset children className clear clientHeight clientInformation clientLeft clientTop clientWidth clientX clientY clip closed | code codeBase (Base URL for the Application) codeBas (Location of Object Implementation) codeType color (Font or Horizontal Rule) color (Text) cols (Text Area Width) cols (Table Columns) cols (Frames) colSpan compact complete content cookie coords cssText ctrlKey currentStyleState cursor
 | Return to top
dataFld dataFormatAs dataPageSize dataSrc defaultCharset defaultChecked defaultSelected defaultStatus defer dialogArguments dialogHeight | dialogLeft dialogTop dialogWidth direction disabled (Control) disabled (Style Sheet) display Document DocumentHTML domain dynsrc
 | Return to top
elements embeds encoding | event external
 | Return to top
face fgColor fileCreatedDate fileModifiedDate fileSize fileUpdatedDate font fontFamily fontSize fontsrc | fontStyle fontVariant fontWeight form forms frameBorder frames frameSpacing fromElement
 | Return to top
hash hasSharedBorders height hidden history host hostname href (Style sheet) href (Destination or anchor point) | href (Baseline URL for Relative Links) href (Location) hspace htmlFor (Element) htmlFor (Control) htmlText htmlViewText httpEquiv
 | Return to top
id ignoreSharedBorders images imports indeterminate index innerHTML | innerText isMap isTextEdit keyCode
 | Return to top
lang language lastModified left leftMargin length letterSpacing lineHeight link | linkColor links listStyle listStyleImage listStylePosition listStyleType listStyleType location loop lowsrc
 | Return to top
margin marginBottom marginHeight marginLeft marginRight marginTop marginWidth maxLength media method Methods mseMode multiple | name (Window or Frame) name (Control, Bookmark, or Application) nameProp navigator noHref noResize noShade noWrap
 | Return to top
offsetHeight offsetLeft offsetParent offsetTop offsetWidth offsetX offsetY onbeforeunload onbeforeunload onbeforeunload onblur (Window) onchange (File Input) onchange (Text Area) onchange (Selection) onchange (Button) onchange (Text Input) onclick (Document2) onclick (IHTMLElement) ondblclick (Document2) ondblclick (IHTMLElement) ondragstart (Document2) ondragstart (IHTMLElement) onfocus (Window) onkeydown (Document2) onkeydown (IHTMLElement) onkeypress (Document2) onkeypress (IHTMLElement) onkeyup (Document2) onkeyup (IHTMLElement) onload (Image) onload (Input Image) | onmousedown (Document2) onmousedown (IHTMLElement) onmousemove (Document2) onmousemove (IHTMLElement) onmouseout (Document2) onmouseout (IHTMLElement) onmouseover (Document2) onmouseover (IHTMLElement) onmouseup (Document2) onmouseup (IHTMLElement) onreadystatechange (Table) onreadystatechange (Link) onreadystatechange (Object) onreadystatechange (Document) onreadystatechange (Style) onresize onscroll (Window) onscroll (Text Container) onselect (Input File) onselect (Text Area) onselect (Input Text) onselect (Body) onselectstart (Document2) onselectstart (IHTMLElement) onunload (Body) options outerHTML overflow owningElement
 | Return to top
padding paddingBottom paddingLeft paddingRight paddingTop pageBreakAfter pageBreakBefore pageContentElement palette parentElement parentStyleSheet parentTextEdit | parentWindow pathname plugins pluginspage port posHeight position posLeft posTop posWidth prompt protocol
 | Return to top
readOnly (Style sheet) readOnly (Element) rel returnValue (Event) rev | rightMargin rowIndex rowSpan rules
 | Return to top
screen screenX screenY scripts scroll scrollAmount scrollDelay scrollHeight scrolling scrollLeft scrollTop scrollWidth search sectionRowIndex selected selectedIndex | selection self shape shiftKey size (Font) size (HRElement Height) size (Control) sourceIndex span src (Sound URL) src (External Source Code) src (URL) srcElement start (ImgElement) start (OListElement) start (Marquee) style styleFloat styleSheet styleSheets
 | Return to top
tabIndex tagName target tBodies text (Range) text (Body-Text Color) text (Block Element) text (Option tag Text) textAlign textDecoration textDecorationBlink textDecorationLineThrough textDecorationNone textDecorationOverline textDecorationUnderline textIndent textTransform | tFoot tHead title (Style Sheet) title (Element) toElement top topMargin trueSpeed type (List Style) type (Selection) type (Style Sheet Language) type (Default Button Behavior) type (Event or script name) type (Mime) type (CSS Language) type (Intrinsic Control) type (Scripting Language)
 | Return to top
units urn useMap vAlign (Caption) vAlign (Element) value (Object) value (Control) value (Ordered Lists) verticalAlign ViewMode visibility vLink | vlinkColor volume vrml (ImgElement) vrml (InputImage) vspace web webbots width (Horizontal Resolution) width (Element – Calculated width) width (Element) window (or self) wrap x y zIndex

Note The FrontPage Page Object Model Help refers to objects, methods, properties and events that are defined in the Internet Explorer 4.0 dynamic HTML Help file (HTMLRef.chm). The examples and remarks given in this Help file were originally created for use with the JavaScript programming language. There are some differences between the JavaScript language and Microsoft Visual Basic. For example, HTMLRef.chm mentions checking for NULL when a property or method returns an object that does not exist. This is incorrect for Visual Basic. In the Visual Basic Language, the type Nothing is returned in this case. Visual Basic users can check an object for Nothing by using the Is keyword.

For example,

If MyObject Is Nothing Then

Also, many of the examples are given in JavaScript instead of Visual Basic. JavaScript is similar to the C++ language in structure and format.

The following is an example ofJavaScript.

var Table = document.all.tags("table").item(0);
var TableCell = table.rows(3).cells(2);
TableCell.innertext = ""
While (p != NULL)
{
    TableCell.innerText = p.tagName;
    var p = p.parentElement
    TableCell.innertext = p.tagName;
    TableCell.innertext += "+";
    TableCell.innertext += TableCell.innertext;
}

The following is the equivalent example in Visual Basic.

Sub SetText()

  Set TableCell = table.Rows(3).Cells(2)
  Set p = TableCell
  TableCell.innerText = ""
  Do While Not p Is Nothing
    TableCell.innerText = p.tagName & "+" & TableCell.innerText
    Set p = p.parentElement
  Loop

End Sub


HTML Properties not Supported by FrontPage 2002

The properties shown in the following list are not supported in this version of Microsoft FrontPage.

appMinorVersion | dir | reason
Atomic | filter | recordNumber
availHeight | filters | referrer
availWidth | fontSmoothingEnabled | returnValue (modal dialog window)
bufferDepth | history | screen
clientInformation | Image | scroll
colorDepth | menuArguments | security
cookie | mimeType | selectedIndex
cookieEnabled | mimeTypes | srcFilter
cpuClass | n | status (Status bar message)
defaultChecked | offscreenBuffering | status (Value of check box or radio button)
defaultSelected | onLine | systemLanguage
defaultStatus | opener | updateInterval
dialogArguments | opsProfile | UserAgent
dialogHeight | Option | UserLanguage
dialogLeft | platform | UserProfile
dialogTop | protocolLong | WordSpacing
dialogWidth | qualifier |


Hidden Language Element

You have requested Help for a language element that is hidden, and therefore unavailable for programmatic access.


abort Method

Stops the transaction. For example, if you're running a macro and you've previously created an undo transaction for the macro, you can programmatically use the abort method to stop the macro when an error condition results.

expression.abort

expression An expression that returns a FPHTMLUndoTransaction object.

Return Type

Void

Remarks

If an error condition occurs that invalidates a transaction object, you can use the abort method to stop the transaction.

Once an UndoTransaction object is created, Microsoft FrontPage places the name of the UndoTransaction object on the Undo portion of the Edit menu in FrontPage.

Example

The following example creates a transaction, performs an operation that adds the operation to the stack, and then requires a response from the user that either aborts the operation or commits it.

Private Sub CreateTransaction()
Dim myTrans As FPHTMLUndoTransaction
Dim myDoc As FPHTMLDocument
Dim myUTransName As String
Dim myMsg As String

Set myDoc = ActiveDocument
myUTransName = "Undo Last Macro"
Set myTrans = _
    myDoc.createUndoTransaction(myUTransName)
myMsg = "Would you like to cancel the operation?"

Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
    "<b> Added by FP Programmability </b>")

Answer = MsgBox(myMsg, vbYesNo, "Cancel Operation?")
If Answer = vbYes Then
    myTrans.abort
Else
    myTrans.commit
End If
End Sub


commit Method

Executes the UndoTransaction object for the series of operations that was added to the undo stack since the time that the UndoTransaction object was created. For example, if you created an UndoTransaction object, and then ran a macro, the commit method allows the macro to continue or, if the macro is finished, the commit method prevents the roll back of the effects of the macro. In other words, the series of operations for the macro are committed and cannot be rolled back.

expression.commit

expression An expression that returns a FPHTMLUndoTransaction object.

Return Type

Void

Example

The following example creates a transaction, performs an operation that adds the operation to the stack, and then requires a response from the user that either aborts the operation or commits it.

Private Sub CreateTransaction()
Dim myTrans As FPHTMLUndoTransaction
Dim myDoc As FPHTMLDocument
Dim myUTransName As String
Dim myMsg As String

Set myDoc = ActiveDocument
myUTransName = "Undo Last Macro"
Set myTrans = _
    myDoc.createUndoTransaction(myUTransName)
myMsg = "Would you like to cancel the operation?"

Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
    "<b> Added by FP Programmability </b>")

Answer = MsgBox(myMsg, vbYesNo, "Cancel Operation?")
If Answer = vbYes Then
    myTrans.abort
Else
    myTrans.commit
End If
End Sub


createUndoTransaction Method

Creates a new instance of an FPHTMLUndoTransaction object for the specified document. An UndoTransaction object provides a tracking mechanism for every action that occurs (after the undo transaction stack was created). You can then use the programming elements provided in the Page object model at run-time to track the actions of a macro.

expression.createUndoTransaction(title)

expression An expression that returns an FPHTMLDocument, IFPDocument, or IHTMLDocument object.

title Required String. The string that represents the title of the FPHTMLUndoTransaction object and appears on the Undo portion of the Edit menu.

Return Type

Object

Example

The following example creates a transaction, performs an operation that adds the operation to the stack, and then requires a response from the user that either aborts the operation or commits it.

Private Sub CreateTransaction()
Dim myTrans As FPHTMLUndoTransaction
Dim myDoc As FPHTMLDocument
Dim myUTransName As String
Dim myMsg As String

Set myDoc = ActiveDocument
myUTransName = "Undo Last Macro"
Set myTrans = _
    myDoc.createUndoTransaction(myUTransName)
myMsg = "Would you like to cancel the operation?"

Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
    "<b> Added by FP Programmability </b>")

Answer = MsgBox(myMsg, vbYesNo, "Cancel Operation?")
If Answer = vbYes Then
    myTrans.abort
Else
    myTrans.commit
End If
End Sub


getBotAttribute Method

Returns the specified strAttributeName attribute for an IHTMLFrontPageBotElement object.

expression.getBotAttribute(strAttributeName)

expression An expression that returns a IHTMLFrontPageBotElement object.

strAttributeName Required String. The string that represents the name of the attribute.

Return Type

Variant

Example

This example uses the getBotAttribute method to initially get the attributes, check if the search bot was correctly set, and then later, it checks if the search bot was deleted.

Private Sub AccessBots()
Dim myMyFPBot As FPHTMLFrontPageBotElement
Dim myBodyObject As FPHTMLBody
Dim myHTMLString As String
Dim myPage As PageWindow

myHTMLString = ""
myHTMLString = myHTMLString & _
    "<!--webbot bot=""Search"" s-index=""All"""
myHTMLString = myHTMLString & _
    " s-fields s-text=""Search for:"""
myHTMLString = myHTMLString & _
    "i-size=""20"" s-submit=""Start Search""
myHTMLString = myHTMLString & _
    " s-clear=""Reset"" s-timestampformat=""%m/%d/%y"""
myHTMLString = myHTMLString & " tag=""BODY"" -->"

Set myBodyObject = ActivePageWindow.Document.body
Set myPage = ActivePageWindow

Call myBodyObject.insertAdjacentHTML("BeforeEnd", _
    myHTMLString)

Set myMyFPBot = _
    myPage.Document.all.tags("webbot").Item(0)

Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myMyFPBot.setBotAttribute("s-submit", "new item")
Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myMyFPBot.removeBotAttribute("s-submit")
Debug.Print myMyFPBot.getBotAttribute("s-submit")

End Sub


removeBotAttribute Method

Removes the attribute specified by the strAttributeName attribute.

expression.removeBotAttribute(strAttributeName)

expression An expression that returns a IHTMLFrontPageBotElement object.

strAttributeName Required String. The string that represents the name of the attribute.

Return Type

Bool

Example

This example uses the removeBotAttribute method to remove a search bot.

Private Sub AccessBots()
Dim myMyFPBot As FPHTMLFrontPageBotElement
Dim myBodyObject As FPHTMLBody
Dim myHTMLString As String
Dim myPage As PageWindow

myHTMLString = ""
myHTMLString = myHTMLString & _
    "<!—webbot bot=""Search"" s-index=""All"""
myHTMLString = myHTMLString & _
    " s-fields s-text=""Search for:"" ""
myHTMLString = myHTMLString & _
    "i-size=""20"" s-submit=""Start Search"""
myHTMLString = myHTMLString & _
    " s-clear=""Reset"" s-timestampformat=""%m/%d/%y"""
myHTMLString = myHTMLString & " tag=""BODY"" -->"

Set myBodyObject = ActivePageWindow.Document.body
Set myPage = ActivePageWindow

Call myBodyObject.insertAdjacentHTML("BeforeEnd", _
    myHTMLString)

Set myMyFPBot = _
    myPage.Document.all.tags("webbot").Item(0)

Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myMyFPBot.setBotAttribute("s-submit", "new item")
Debug.Print myFPBot.getBotAttribute("s-submit")
Call myFPBot.removeBotAttribute("s-submit")
Debug.Print myFPBot.getBotAttribute("s-submit")

End Sub


setBotAttribute Method

Sets an attribute for an FPHTMLFrontPageBotElement object.

expression.setBotAttribute(strAttributeName, AttributeValue)2)

expression An expression that returns a FPHTMLFrontPageBotElement object.

strAttributeName Required STRING.

AttributeValue)2 Required VARIANT.

Return Type

Void

Example

This example uses the setBotAttribute method to set a search bot.

Private Sub AccessBots()
Dim myMyFPBot As FPHTMLFrontPageBotElement
Dim myBodyObject As FPHTMLBody
Dim myHTMLString As String
Dim myPage As PageWindow

myHTMLString = ""
myHTMLString = myHTMLString & _
    "<!--webbot bot=""Search"" s-index=""All"""
myHTMLString = myHTMLString & _
    " s-fields s-text=""Search for:"""
myHTMLString = myHTMLString & _
    "i-size=""20"" s-submit=""Start Search"""
myHTMLString = myHTMLString & _
    " s-clear=""Reset"" s-timestampformat=""%m/%d/%y"""
myHTMLString = myHTMLString & " tag=""BODY"" -->"

Set myBodyObject = ActivePageWindow.Document.body
Set myPage = ActivePageWindow

Call myBodyObject.insertAdjacentHTML("BeforeEnd", _
    myHTMLString)

Set myMyFPBot = _
    myPage.Document.all.tags("webbot").Item(0)

Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myMyFPBot.setBotAttribute("s-submit", "new item")
Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myMYFPBot.removeBotAttribute("s-submit")
Debug.Print myMYFPBot.getBotAttribute("s-submit")

End Sub


IFPDocument Object

Represents the Microsoft FrontPage document. The IFPDocument object includes properties and methods that return objects compatible with Microsoft Internet Explorer 4.0 and later, but not with the Internet Explorer 5 Dynamic HTML object model.

Using the UndoTransaction Object

You can use the createUndoTransaction method of the IFPDocument object to create an UndoTransaction object.

Set myUndoTransaction = _
    ActiveDocument.createUndoTransaction(myUTransName)

Use the DocumentHTML property to return a vector string that contains the entire text within the specified document. The following statement retrieves the vector string for the variable myDocObject.

myDocHTML = myDocObject.DocumentHTML

Use the isDirty property to return the state of the document—has it been modified since the last save? If the document has been modified then the property will return True.

myIsDirty = IFPDocument.isDirty


IHTMLFrontPageBotElement Object

Represents a component in Microsoft FrontPage.

Using the IHTMLFrontPageBotElement

FrontPage provides the ability to get, remove, and set bot attributes. The following statements illustrate accessing the following methods: getBotAttribute, removeBotAttribute, and setBotAttribute.

Call myMyFPBot.setBotAttribute("s-submit", "new item")
Debug.Print myMyFPBot.getBotAttribute("s-submit")
Call myFPBot.removeBotAttribute("s-submit")


UndoTransaction Object

Represents the cache where the actions performed by a macro are stored. The UndoTransaction object includes methods that continue or stop the specified transaction.

Using the UndoTransaction Object

You can use the createUndoTransaction method of the IFPDocument object to create an UndoTransaction object. The following example creates an undo transaction illustrating the abort and commit methods.

Private Sub CreateTransaction()
Dim myTrans As FPHTMLUndoTransaction
Dim myDoc As FPHTMLDocument
Dim myUTransName As String
Dim myMsg As String

Set myDoc = ActiveDocument
myUTransName = "Undo Last Macro"
Set myTrans = _
    myDoc.createUndoTransaction(myUTransName)
myMsg = "Would you like to cancel the operation?"

Call myDoc.body.insertAdjacentHTML("BeforeEnd", _
    "<b> Added by FP Programmability </b>")

Answer = MsgBox(myMsg, vbYesNo, "Cancel Operation?")
If Answer = vbYes Then
    myTrans.abort
Else
    myTrans.commit
End If
End Sub


DocumentHTML Property

Returns the entire set of HTML tags for the specified Document object in string format. Read/write String.

Example

This example displays all of the HTML tags in the Immediate window.

Private Sub ListAllTags()
Dim myDocObject As FPHTMLDocument
Dim myDocHTML As String

Set myDocObject = ActivePageWindow.ActiveDocument

myDocHTML = myDocObject.DocumentHTML
Debug.Print myDoc

End Sub


external Property

Returns a PageWindow object from within a frame. Read-only Object.

Example

This example returns the page window where the active frame resides.

Private Sub GetExternal()
Dim myExternalObject As PageWindow

Set myExternalObject = _
    ActivePageWindow.ActiveFrameWindow.Window.external
End Sub


isDirty Property

Returns True if the specified IFPDocument object has been modified since it was last saved. Read/write Boolean.

Example

This example retrieves the IsDirty property for the ActiveFrameWindow object.

Private Sub GetExternal()
Dim myExternalObject As PageWindow
Dim ckIfDirty As Boolean

Set myExternalObject = _
    ActivePageWindow.ActiveFrameWindow.Window.external
ckIfDirty = myExternalObject.IsDirty
End Sub


nameProp Property

Returns the name of the specified document. Read/write Boolean.

Example

This statement retrieves the name of the active document.

myNameProp = ActiveDocument.nameProp


ReadyState Property

Returns the state of the specified object. Read-only String.

Example

This statement returns the ready state of the active document.

myDocState = ActiveDocument.ReadyState


selectorText Property

Returns the selection string for the style sheet rule. Read/write String.

Example

This example retrieves the selector text from the first style sheet rule.

Note You must have a style sheet attached to an open document.

Private Sub GetSelectorText()
Dim myRule As IHTMLStyleSheetRule
Dim myText As String

Set myRule = ActiveDocument.styleSheets(0).rules(0)
myText = myRule.selectorText
End Sub


whiteSpace Property

Sets or returns the whiteSpace attribute for inline HTML styles. Click one of the links below for more information on this property. Read/write String.

Example

The following statement sets the whiteSpace attribute to nowrap.

Note You must have an inline HTML style applied.

ActiveDocument.body.Style.whiteSpace = "nowrap"


IFPDocument Object


IHTMLFrontPageBotElement Object


createUndoTransaction Method


getBotAttribute Method

 removeBotAttribute Method

 setBotAttribute Method


INDEX~TEXT
seealso~"See&nbsp;Also"
appliesto~"Applies&nbsp;To"
elements~"Elements"
properties~"Properties"
methods~"Methods"
events~"Events"
example~"Example"
specifics~"Specifics"
show~"Show&nbsp;description"
hide~"Hide&nbsp;description"