Script Property

Microsoft PowerPoint Visual Basic

Script Property

       

Returns a Script object that represents a block of script code on a Microsoft PowerPoint slide. In PowerPoint, script is associated with an anchor shape. If no script is associated with the specified shape, then nothing is returned. Read-only.

Remarks

Script code inserted on a slide can only be run in Web presentations.

By default, script anchor shapes are not visible. To make them visible, use the PowerPoint user interface. You cannot make script anchor shapes visible with Visual Basic code.

It is possible to use the Script property on a range of shapes (ShapeRange.Script) instead of specifying a single anchor shape. However, if the range contains more than one shape, your code will not work and will return a message that indicates the Script property cannot be accessed.

Example

This example sets the scripting language for the script anchor (shape eight on slide one) to Microsoft Visual Basic Scripting Edition (VBScript).

With ActivePresentation.Slides(1).Shapes(8)
    .Script.Language = msoScriptLanguageVisualBasic
End With