Scripts Interface
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Scripts Interface

A collection of Script objects that represent the collection of HTML scripts in the specified document.

Namespace:  Microsoft.Office.Core
Assembly:  office (in office.dll)

[GuidAttribute("000C0340-0000-0000-C000-000000000046")]
public interface Scripts : _IMsoDispObj, 
	IEnumerable

The Scripts collection contains all of the Script objects in a given document, in source order (the order in which Script objects were added to the source file). Source order isn’t affected by the location (header or body text) of the script in the document. The Scripts collection can be accessed by using the Scripts property of the appropriate object (for example, the Document object in Microsoft Word).

You can use Script objects to access a script or to add a script to a Microsoft Word document, a Microsoft Excel worksheet, or a Microsoft PowerPoint slide. You can also use the Scripts collection to access any HTML page or script that’s opened in a Microsoft Office application.

Note   Microsoft Access doesn’t use this shared Office component.

When you add a Script object to the Scripts collection, a Shape object of type msoScriptAnchor is automatically added to the document. On an Excel worksheet or a PowerPoint slide, the shape is added to the Shapes collection; in a Word Document, the shape is added to the InlineShapes collection. You add a Script to a document by using the Add method.

To access a particular item in the Scripts collection, use the Item method and supply either the ID attribute of the <SCRIPT> tag or the index number that indicates the position of the script in the collection. The ID must be unique within the document. In the case of duplicate ID attributes, the first script found that has that ID is returned.

Use the Count property to determine the number of Script objects in the specified document.

Use the Delete method to remove a script from the Scripts collection.

Show:
© 2016 Microsoft