DIAdem Help

Method: Execute for VBS

  • Updated2024-09-12
  • 1 minute(s) read

Method: Execute for VBS

Executes instructions. If you use an instruction like "x = y", the Execute method assigns the y value to the x variable. If, instead, you want to check whether both values are the same, use the Eval method.

Object.Execute(string)
ObjectVBS
Object with this method. You do not need to specify this object.
stringVariant
Specifies a string containing one or more instructions.

The following example illustrates how to use the Execute method:

Dim MyVar1, MyVar2
MyVar1 = 1
MyVar2 = 2
Call Execute("MyVar1 = MyVar2 + 1")
Call MsgBox(MyVar1) ' Returns 3

The following example defines a HelloWorld procedure and executes it:

Dim MyStr
MyStr = "Sub HelloWorld() : Call MsgBox(""Hello World!"") : End Sub"
Call ExecuteGlobal(MyStr)
Call HelloWorld

See Also

Objects Overview

Related Topics

Eval | Execute | RegExp

Log in to get a better experience