Showing results 1 to 4 of 4

Thread: Error during the first macro activation

  1. #1
    Join Date

    Default Error during the first macro activation

    I need a help again.

    An error "Type mismatch" is appeared during first activation of VBA macro in Runtime mode.

    It has happened when I tried to convert variable with type of double to string :

    b = thisproject.variables.item(i).value

    And when I traced it, the function str() had worked good. And after that macro worked without any mistakes.

    How can I execute the macro without this mistake at the first launch?

  2. #2
    martins Gast

    Default Re: Error during the first macro activation


    I guess that this error happens when starting the runtime, right?

    It seems to me that the variable you are trying to convert is not assigned. You can check this with the IsOnline method. Variables can be assigned by setting "DDE active" in the additional settings of the variable or by using an OnlineContainer.

    I don't know exactly what you are trying to do, but this should work:

    If thisProject.Variables.Item(i).IsOnline Then
    b = thisProject.Variables.Item(i).Value
    a = Str(b)
    End If

  3. #3
    Join Date

    Default Re: Error during the first macro activation

    I followed your advice, but the problem was that the variables don't become ready until several minutes after Runtime reloading pass. The problem disappears in 2 minutes. I don't know how to inform the user that the application is not ready and avoid the system error. The error is still actual

  4. #4

    Default Re: Error during the first macro activation

    there may be some communication issue to one or more variables or stations in the driver configuration, that cause delays. Perhaps one or more PLCs are not available that can cause a timeout, depending on the driver configuration and the project setup.

    To which driver does this variable belong?

    If you put the variable in a screen, does it also take 2 minutes for the value to be shown?

Similar Threads

  1. SBO activation
    By roberto1978 in forum Drivers
    Replies: 3
    Last Post: 1st December 2009, 14:25
  2. Execute VBA macro
    By captain in forum VBA
    Replies: 1
    Last Post: 24th November 2009, 23:58
  3. Replies: 1
    Last Post: 11th June 2009, 08:02
  4. Missing remote activation number
    By scotttee in forum zenon Operator
    Replies: 1
    Last Post: 9th March 2009, 10:36
  5. How to create a new MACRO?
    By matholton in forum VBA
    Replies: 2
    Last Post: 24th September 2008, 12:14

Posting Rules

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