Call VBA macro function from the load script

Let’s see how to call a macro function within the script. We will build the function “Inc()” which will increment by 1 the passed parameter and return the result to the script.

In the macro editor write:

function Inc(Value)
Inc = Value+1
end function

Now, in the script, we will use a variable to receive the function result and display it in the interface:

LET _VAR1 = Inc(1);

Remember, you can call functions, not subroutines. And inside the functions, don’t call interface elements since they are not available during the load.

Tagged with: , ,
Posted in Script
9 comments on “Call VBA macro function from the load script
  1. Viktor says:

    Good to know, but is there any chance calling a VB function from an Expression!?

  2. danilo says:

    how can i call not a function but a SUB VBScript from Load Script?

  3. leonardo says:

    hello, could you please give me an example about creating a function that calls a SUB?
    thanks a lot

  4. leonardo says:

    Hello, could you please send a qvw example file?

  5. Abhishek Pansotra says:

    Hi, I m trying to do the same.. but not able to call the function from script.. I have just pasted the exact on module and script.. but getting no result.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: