Edytuj

Udostępnij za pośrednictwem


Scripts Interface

Definition

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
[System.Runtime.InteropServices.Guid("000C0340-0000-0000-C000-000000000046")]
public interface Scripts : Microsoft.Office.Core._IMsoDispObj, System.Collections.IEnumerable
[<System.Runtime.InteropServices.Guid("000C0340-0000-0000-C000-000000000046")>]
type Scripts = interface
    interface _IMsoDispObj
    interface IEnumerable
Public Interface Scripts
Implements _IMsoDispObj, IEnumerable
Attributes
Implements

Remarks

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.

Properties

Application

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

Count

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

Creator

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

Parent

Returns the Parent object for the specified object.

Methods

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()

Deletes the specified object from the collection.

GetEnumerator()
Item(Object)

Returns a member of the Scripts collection.

Applies to