Méthode document. ExecuteLine (Visio)Document.ExecuteLine method (Visio)
Exécute une ligne de code Microsoft Visual Basic.Executes a line of Microsoft Visual Basic code.
SyntaxeSyntax
expression. ExecuteLine (Ligne)expression.ExecuteLine (Line)
expression Variable qui représente un objet document .expression A variable that represents a Document object.
ParamètresParameters
NomName | Requis/FacultatifRequired/Optional | Type de donnéesData type | DescriptionDescription |
---|---|---|---|
LineLine | ObligatoireRequired | StringString | Chaîne qui sera interprétée comme du code Microsoft Visual Basic pour Applications (VBA).A string that will be interpreted as Microsoft Visual Basic for Applications (VBA) code. |
Valeur renvoyéeReturn value
AucuneNothing
RemarquesRemarks
Le projet VBA de l'objet Document reçoit l'instruction d'exécuter la chaîne fournie.The VBA project of the Document object is told to execute the supplied string. VBA traite la chaîne comme il traiterait la même chaîne tapée dans la fenêtre Exécution.VBA treats the string as it would treat the same string typed into its Immediate window.
ExempleExample
Voici quelques utilisations possibles de la méthode ExecuteLine :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")
Assistance et commentairesSupport and feedback
Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ?Have questions or feedback about Office VBA or this documentation? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.