QueryContents Property

Microsoft FrontPage Visual Basic

QueryContents Property

Sets or returns a String that is an XML representation of the query.

expression.QueryContents

expression    Required. An expression that returns a SearchInfo object.

Example

The following example searches for TD elements in the current selection and adds the align attribute with a value of "center."

    Dim objSearch As SearchInfo
Dim objRange As IHTMLTxtRange
Dim blnMatches As Boolean
Dim strQuery As String

strQuery = "<?xml version=""1.0""?><fpquery version=""1.0"">" & _
    "<find tag=""td""><rule type=""insideTag"" tag=""table"" />" & _
    "</find><replace type=""setAttribute"" attribute=""align"" " & _
    "value=""center""/></fpquery>"

Set objRange = ActiveDocument.selection.createRange
Set objSearch = Application.CreateSearchInfo

objSearch.QueryContents = strQuery
blnMatches = Application.ActiveDocument.Find(objSearch, Nothing, objRange)
If blnMatches = True Then objRange.Select