ExecuteLine Method [Visio 2003 SDK Documentation]
Executes a line of Microsoft Visual Basic code.
object**.ExecuteLine** (Line)
object Required. An expression that returns a Document object.
Line Required String. A string that will be interpreted as Microsoft Visual Basic for Applications (VBA) code.
Version added
4.5
Remarks
The VBA project of the Document object is told to execute the supplied string. VBA treats the string as it would treat the same string typed into its Immediate window.
Example
The following are some possible uses of the ExecuteLine method:
'Executes the macro (procedure without an argument) named "SomeMacro"
'that is in some module of the Visual Basic project of ThisDocument.
ThisDocument.ExecuteLine("SomeMacro")
'Executes the procedure named SomeProcedure and passes it 3 arguments.
ThisDocument.ExecuteLine("SomeProcedure 1, 2, 3")
'Same as previous example, but procedure name qualified
'with module name.
ThisDocument.ExecuteLine("Module1.SomeProcedure 1, 2, 3")
'Shows the form UserForm1.
ThisDocument.ExecuteLine("UserForm1.Show")
'Prints "some string" to the Immediate window.
ThisDocument.ExecuteLine("Debug.Print ""some string""")
'Prints number of open documents to the Immediate window.
ThisDocument.ExecuteLine("Debug.Print Documents.Count")
'Tells ThisDocument to save itself.
ThisDocument.ExecuteLine("ThisDocument.Save")
Applies to | Document object
See Also | AddOnName property | ParseLine method | VBE property | VBProject property