Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am using QV 11 Personal Edition
I have written a sub routine to calculate dates based on a selection.
I have kept a slider control and when the value of the slider changes, it should call this subroutine and inturn calculate the dates.
My sub routine is like this
SUB SubName
SET var1 = some date conversion
SET var2 = other conversion
ENDSUB
I will be using these variables in other controls
I went to the Field Event Trigger (the field is linked to the slider control) and added an External -> Run Macro action for OnSelect event
I tried to call the subroutine using
SubName
as well as
CALL SubName
Both didn't work out. Can anyone help please..
Oops..
How to use the variables already defined in the script editor inside a macro.
Now only I am checking my macro. It is throwing error.
Please help, I am new to QV & macro. How to use the functions of QV inside a macro and set & get variables
Is writing macro different from writing a subroutine in the script editor? I am confused.
Can we write a subroutine in Edit Script area instead of macro? If so how to call that in an event trigger action?
Hi,
In macro you can get variable like this
Get and set variable value in macro
Set value = ActiveDocument.Variables("VariableName")
I am not sure writing a subroutin in the script editor. It is good practice to write macros in Macro Editor.
Regards,
jagan.
Writing script is to load data inside application.
Writing macros (CNTR+M). You can write Sub routine as well as function inside MAcros.
Subroutine can be directly called by name and function you have to write Call FunctionName.
Also you can get variable and set values as follow
set varValNonVol = ActiveDocument.GetVariable("Vol-NonVol")
varValNonVol.SetContent "Non voluntary",true
Thanks Jagan & Swapnil. Will try these out.
May I know how to create a function?
Is it
Function
End Function
?
It is throwing error.
I don't know what I did, I am unable to open the macro window itself.
When I press Ctlr+M or from the menu, QV is getting minimized. Anybody faced this issue?
May be there is limitation in personnnel edition.
Try function as
Function funName
End Function
Thanks swapnil.
Now the function is not throwing any error and i tried with msgbox and it shows correct value
I wrote like this
Function funName (var)
blah blah blah
funName = blah blah blah
End Function
But how to use this function in a trigger action? I want to pass a date as the param value and it will return another date
I am using a trigger action for a field value change and setting the return value to another variable
I tried calling the function, but it is not giving any output
I tried
=funName(var1)
as well as
=funName($(var1))
Both didnt work. Any help please?