Command: AddUserCommandToEvent
- Updated2023-02-21
- 1 minute(s) read
Command: AddUserCommandToEvent
Adds a user command to a list of user commands which you assign to an event. If you execute the AddUserCommandToEvent command several times, you can assign several user commands to the same event.
AddUserCommandToEvent(EventName, UserCommandName)
Input Parameters
| EventName | String Specifies the name of a DIAdem event. You cannot transfer the event as a reference ("by reference"). |
| UserCommandName | String Specifies a user command registered in DIAdem. |
Example
The following example assumes that you registered the two user commands MyFirstCommand and MySecondCommand in DIAdem. Assign both user commands to the event View.Events.OnActiveSheetChanged. When changing the active worksheet in DIAdem VIEW, DIAdem executes the two user commands MyFirstCommand and MySecondCommand.
| VBScript | Python |
Call AddUserCommandToEvent("View.Events.OnActiveSheetChanged","MyFirstCommand") Call AddUserCommandToEvent("View.Events.OnActiveSheetChanged","MySecondCommand")
Use the RemoveUserCommandFromEvent command to delete a user command from the list of user commands. To not assign a user command to an event anymore, assign an empty string, for example, View.Events.OnActiveSheetChanged= "" to the event.