Scripts.Add Method
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.
Namespace: Microsoft.Office.Core
Assembly: office (in office.dll)
Syntax
'Declaration
Function Add ( _
Anchor As Object, _
Location As MsoScriptLocation, _
Language As MsoScriptLanguage, _
Id As String, _
Extended As String, _
ScriptText As String _
) As Script
'Usage
Dim instance As Scripts
Dim Anchor As Object
Dim Location As MsoScriptLocation
Dim Language As MsoScriptLanguage
Dim Id As String
Dim Extended As String
Dim ScriptText As String
Dim returnValue As Script
returnValue = instance.Add(Anchor, Location, _
Language, Id, Extended, ScriptText)
Script Add(
Object Anchor,
MsoScriptLocation Location,
MsoScriptLanguage Language,
string Id,
string Extended,
string ScriptText
)
Parameters
Anchor
Type: System.ObjectOptional Object (Microsoft Excel only). The Anchor argument accepts an Excel Range object, which specifies the placement of the script anchor on an Excel Worksheet. You cannot insert script anchors into Excel charts.
Location
Type: Microsoft.Office.Core.MsoScriptLocationOptional MsoScriptLocation. Specifies the location of the script anchor in a document. If you’ve specified the Anchor argument, the Location argument isn’t used; the location of the Anchor argument determines the location of the script anchor.
Language
Type: Microsoft.Office.Core.MsoScriptLanguageOptional MsoScriptLanguage. Specifies the script language.
Id
Type: System.StringOptional String. The ID of the <SCRIPT> tag in HTML. The Id argument specifies an SGML identifier used for naming elements. Valid identifiers include any string that begins with a letter and is composed of alphanumeric characters; the string can also include the underscore character ( _ ). The ID must be unique within the HTML document. This parameter is exported as the ID attribute in the <SCRIPT> tag.
Extended
Type: System.StringOptional String. Specifies attributes that are to be added to the <SCRIPT> tag (LANGUAGE and ID attributes are exported through the Language and Id parameters and should not be exported through the Extended parameter). The default is the empty string. Attributes are separated by spaces, the same as in HTML. The Microsoft Office host application doesn’t provide any means of checking the syntax of passed attributes.
ScriptText
Type: System.StringOptional String. Specifies the text contained in a block of script. The default is the empty string. The Microsoft Office host application doesn’t check the syntax of the script.
Return Value
Type: Microsoft.Office.Core.Script
Remarks
A shape associated with a script block isn’t exported or printed as a shape in HTML; only the script block returns exported.
You cannot use the Add method to add a script anchor to a PowerPoint slide range that contains more than one slide.