Document.ExecuteLine method (Visio)
Executes a line of Microsoft Visual Basic code.
Syntax
expression.ExecuteLine (Line)
expression A variable that represents a Document object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Line | Required | String | A string that will be interpreted as Microsoft Visual Basic for Applications (VBA) code. |
Return value
Nothing
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")
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기