Scripts Property

Microsoft Word Visual Basic

Scripts Property

       

Returns a Scripts collection that represents the collection of HTML scripts in the specified object.

expression.Scripts

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

Example

This example displays the text in the first Script object of the active document.

Debug.Print ActiveDocument.Scripts(1).ScriptText

This example tests the second Script object in the specified range to determine its language.

Select Case Selection.Range.Scripts(2).Language
    Case msoScriptLanguageASP
        MsgBox "Active Server Pages"
    Case msoScriptLanguageVisualBasic
        MsgBox "VBScript"
    Case msoScriptLanguageJava
        MsgBox "JavaScript"
    Case msoScriptLanguageOther
        MsgBox "Unknown type of script"
End Select