Bookmark.Scripts Property (2007 System)

Gets a Scripts collection that represents the collection of HTML scripts in the Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Scripts As Scripts
'Usage
Dim instance As Bookmark 
Dim value As Scripts 

value = instance.Scripts
[BrowsableAttribute(false)]
public Scripts Scripts { get; }
[BrowsableAttribute(false)]
public:
property Scripts^ Scripts {
    Scripts^ get ();
}
public function get Scripts () : Scripts

Property Value

Type: Scripts
A Scripts collection that represents the collection of HTML scripts in the Bookmark control.

Examples

The following code example adds a Script to the first paragraph, and then adds a Bookmark control to the first paragraph. The code then displays the number of scripts the bookmark contains in a message box.

This example is for a document-level customization.

Private Sub BookmarkScripts()
    Dim scriptRange As Word.Range = Paragraphs(1).Range
    Dim myScript As Office.Script = Me.Scripts.Add( _
        scriptRange, Microsoft.Office.Core.MsoScriptLocation _
        .msoScriptLocationInBody, Microsoft.Office.Core _
        .MsoScriptLanguage.msoScriptLanguageVisualBasic, _
        "Script ID", "Extended", "Script Text")

    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    MessageBox.Show("Number of scripts in bookmark1: " & _
        Bookmark1.Scripts.Count.ToString)

End Sub
private void BookmarkScripts()
{
    Word.Range scriptRange = Paragraphs[1].Range;
    Office.Script myScript = this.Scripts.Add(scriptRange, Microsoft.Office.Core.MsoScriptLocation.msoScriptLocationInBody,
        Microsoft.Office.Core.MsoScriptLanguage.msoScriptLanguageVisualBasic, "Script ID", "Extended", "Script Text");

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(Paragraphs[1].Range, "bookmark1");
    MessageBox.Show("Number of scripts in bookmark1: " +
        bookmark1.Scripts.Count.ToString());
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace