Share via


action Property

As it applies to the SearchInfo object.

fpSearchAction

fpSearchAction can be one of the following fpSearchAction constants.

fpSearchFindTag Searches for matching text in the HTML tags.
fpSearchFindText Searches for matching text in the document.
fpSearchReplaceAllText Searches and replaces all matching text in the document.
fpSearchReplaceText Replaces the text and searches for the next occurence.

expression.action

*expression   * Required. An expression that returns a SearchInfo object.

As it applies to all other objects in the Applies To list.

Sets or returns a String that represents the URL where the content of a form is sent for processing. This URL could represent a database, an e-mail address, or an ASP page.

expression.action

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

The action property sets the action attribute for the FORM element. The way the form submits data depends on the value of the method and encoding properties.

Example

As it applies to the SearchInfo object.

The following example selects the next occurence of the P element, if one is found in the active document.

Dim objSearch As SearchInfo
Dim blnFound As Boolean
Dim objRange As IHTMLTxtRange

Set objSearch = Application.CreateSearchInfo
objSearch.Find = "p"
objSearch.Action = fpSearchFindTag

Set objRange = Application.ActiveDocument.selection.createRange
blnFound = Application.ActiveDocument.Find(objSearch, Nothing, objRange)
If blnFound = True Then objRange.Select

As it applies to the FPHTMLFormElement object.

The following example sets the URL for the action, method, and encoding properties for the specified form.

Sub SetFormAction(objForm As FPHTMLFormElement, _
        strAction As String, strMethod As String, _
        strEncoding As String)
    
    With objForm
        .action = strAction
        .method = strMethod
        .encoding = strEncoding
    End With
End Sub

Use the following subroutine to call the preceding subroutine.

Sub CallSetFormAction()
    Dim objForm As FPHTMLFormElement
    
    ActiveDocument.body.insertAdjacentHTML "beforeend", _
        "<form id=""newform""></form>"
    Set objForm = ActiveDocument.all.tags("form").Item("newform")

    Call SetFormAction(objForm, "mailto: someone@example.com", _
        "post", "application/x-www-form-urlencoded")
End Sub

Applies to | FPHTMLFormElement Object | FPHTMLIsIndexElement Object | IHTMLFormElement Object | IHTMLIsIndexElement Object | SearchInfo Object