IFPDocument Object

Microsoft FrontPage Visual Basic

IFPDocument Object

IFPDocument Multiple objects

Represents a 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. See also the FPHTMLDocument object and the IHTMLDocument2 object.

Using the IFPDocument object

Use the ActiveDocument property to return an IFPDocument object. The following example creates an IFPDocument object variable, assigns it to the active document, and then uses the isDirty property to see if the page has changed. If the page has changed, the example saves it.

    Sub SaveChangedPage()
    Dim objDoc As IFPDocument
    
    On Error GoTo UnableToSavePage
    
    Set objDoc = ActiveDocument
    
    If objDoc.IsDirty = True Then ActivePageWindow.Save

ExitSub:
    Exit Sub
    
UnableToSavePage:
    MsgBox "Unable to save the page.  " & _
        "If you haven't saved the page previously, " & _
        vbCrLf & "you need to save it first before " & _
        "you can use the Save method."
        
    GoTo ExitSub
End Sub
  

Use the DocumentHTML property to return a String that contains the entire HTML and text within the specified document. The following statement retrieves the HTML in the active document, replaces every occurrence of "red" with "green", and writes the changed HTML back to the document.

    Sub ViewDocumentHTML()
    Dim objDoc As IFPDocument
    Dim strHTML As String
    
    Set objDoc = ActiveDocument
    strHTML = objDoc.DocumentHTML
    
    strHTML = Replace(strHTML, "red", "green")
    
    objDoc.DocumentHTML = strHTML
End Sub