Scripts Scripts Scripts Interface


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

public interface class Scripts : Microsoft::Office::Core::_IMsoDispObj, System::Collections::IEnumerable
public interface Scripts : Microsoft.Office.Core._IMsoDispObj, System.Collections.IEnumerable
Public Interface Scripts
Implements _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(Object, MsoScriptLocation, MsoScriptLanguage, String, String, String) method.

To access a particular item in the Scripts collection, use the Item(Object) 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.


Application Application Application

Returns an Application object that represents the container application for the object.

Count Count Count

Returns an Integer indicating the number of items in the specified collection.

Creator Creator Creator

Returns a 32-bit integer that indicates the application in which the specified object was created.

Parent Parent Parent

Returns the Parent object for the specified object.


Add(Object, MsoScriptLocation, MsoScriptLanguage, String, String, String) Add(Object, MsoScriptLocation, MsoScriptLanguage, String, String, String) Add(Object, MsoScriptLocation, MsoScriptLanguage, String, String, String)

Adds a Script object to the Scripts collection of one of the following objects: a Document or Range object in Microsoft Word; a Worksheet or Chart object in Microsoft Excel; or a Slide, SlideRange, slide Master, or title Master object in Microsoft PowerPoint.

Delete() Delete() Delete()

Deletes the specified object from the collection.

GetEnumerator() GetEnumerator() GetEnumerator()
Item(Object) Item(Object) Item(Object)

Returns a member of the Scripts collection.

Applies to