Hi,
let>res=This is a test message
VBSTART
dim res
msg=res
MsgBox(msg)
VBEND
What is missing in the above code snippet? Or the only way to link vbscript and macro is to use function and sub commands of vbscript? Meaning:
let>res=This is a test message
VBSTART
Sub DisplayMessage (msg)
MsgBox msg
End Sub
VBEND
VBRun>DisplayMessage,res
??
Accessing variable inside Vbstart-VBEnd block
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You can use VBEval to evaluate a VBScript expression. A VBScript expression could be just a variable:
The VBEval statement is evaluating the value of res which of course is "fred".
Often we need to use both methods. E.g. you may VBEval a VBScript function which creates an array or modifies a set of global VBScript variables which you later might want to evaluate in MacroScript using VBEval.
Code: Select all
VBSTART
dim res
res = "fred"
VBEND
VBEval>res,myRes
MessageModal>myRes
Often we need to use both methods. E.g. you may VBEval a VBScript function which creates an array or modifies a set of global VBScript variables which you later might want to evaluate in MacroScript using VBEval.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
In this case you must pass the value to a VBScript sub/function. The VBScript must appear before the VBRun/VBEval:
Code: Select all
VBSTART
Sub DoSomething(x)
MsgBox x
End Sub
VBEND
VBRun>DoSomething,Hello World
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?