How to use VBA macros
|Show all Hide all|
In order to create a new macro in the window Project info on the property page Macrp Browser select a desired event, when the new macro should be executed.
Clicking on this event with the right mouse button opens a menu.
Select the menu entry "New macro..." With this zenon generates a procedure as listed below:
Sub LeftClickUp_Sollwert(obElem As Element)
If a macro already exists, it can be edited, deleted or renamed by clicking it with the right mouse button.
If you rename the macro, take care that you do not change the name of the event e.g. LeftClickUp_. Otherwise renaming will not be executed. Additionally you have to change the name of the sub program to be executed in the VBA Editor by hand, if you rename a macro.
After you have filled the procedure generated by zenon with the source code to be executed, the created macro has to be linked to an element.
Doubleclicking the element opens the property dialog of the element.
On the property page Events the macro is linked to the element.
Clicking the element with the left mouse button executed the LeftClickDown event of the element and the linked macro.