Showing results 1 to 4 of 4

Thread: Transmit trigger variable into VBA makro

  1. #1
    Join Date

    Default Transmit trigger variable into VBA makro


    I just wrote a little makro which saves the last values of a variable after calling the makro from a trigger variable limit.
    I would like to use it on more Variables with different trigger variables.
    Is there a possibility to transmit the variablename of the trigger variable into VBA?

    Thank you!

  2. #2

    Default Re: Transmit trigger variable into VBA makro

    The limit or variable from which the VBA macro function is executed is not available to the VBA macro. Unless the trigger is also an alarm, you have to pass the information about the variable into the macro.

    The zenon function to execute VBA macros also takes string parameters. Instead of creating seperate VBA macros and having to maintain each of these, you could create different execute VBA macro functions each with a different parameter and link these at the appropriate variables, to pass on the variable.

    With many variables it may be easier to monitor these in an online container and save the changes on the value here.

  3. #3
    Join Date

    Default Re: Transmit trigger variable into VBA makro

    That sounds quite good.
    Is there any further description or example how to use these Parameters?

    Thank you!

  4. #4

    Default Re: Transmit trigger variable into VBA makro

    At the zenon function "execute VBA macro" you can configure parameters.

    After you configure the parameters, the macro selection dialog offers only those VBA macros that match exactly the number of parameters you have configured:

    This small VBA macro takes to string variables as paramaters.

    Sub DoSomething(mString1 As String, mString2 As String)
        MsgBox (mString1 & " " & mString2)
    End Sub

    At the "execute VBA macro" function you define two new parameters, which are passed to the macro on execution.

    Click image for larger version

Name:	ScreenShot286.png
Views:	52
Size:	17.3 KB
ID:	558

Similar Threads

  1. Start/Stop Arvhive on PLC Trigger
    By joebloggs in forum Drivers
    Replies: 3
    Last Post: 13th February 2020, 10:10
  2. VBA Makro wird nicht Abgearbeitet
    By in forum VBA
    Replies: 9
    Last Post: 27th September 2011, 09:58
  3. VBA Makro geöffnete Bilder schliessen
    By perschke in forum VBA
    Replies: 5
    Last Post: 31st August 2010, 13:25

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts