Working with Scripts

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

You can use the Scripts collection and the Script object to programmatically access script, or insert script into a cell or range in a Microsoft® Excel worksheet, a Microsoft® PowerPoint® slide, or a Microsoft® Word document or Word Selection object. In addition, if you use a Microsoft® Office application to open an HTML page, any script contained in that page will be available through the Scripts collection.

Every Script object that is inserted in an Office document includes a Shape object of the type msoScriptAnchor. In Excel and PowerPoint, these shapes are added to the Worksheet or Slide object's Shapes collection. In Word, these shapes are added to a document's InLineShapes collection.

If you want to write script in a document you create in an Office application, use the Microsoft Script Editor. On the other hand, if you want to add script to an Office document programmatically, from an add-in for example, use the objects, properties, and methods of the script object model discussed here.

In This Section