Solved
Forum Discussion
- jeetendra_mittaOccasional ContributorThanks for your valuable information, but if I want to execute msgbox "Hello", i am facing problem becasue there are " (two times).
- HKosova
Alumni
Simply enter:
- it's an Eval'able function call.
In a general case, you need to double the quotes inside the string: - HKosova
Alumni
You can run commands in the Evaluate dialog, too. Enter the command in the Expression text box. If the command returns a value, you'll see it in the Result box. - jeetendra_mittaOccasional ContributorSuppose I missed to declare any variable and already started the execution. This time I use the breakpoint and tries to run the command "Dim var_name", I get syntax error in Resutls field. But in QTP we can easily do that operation.
- HKosova
Alumni
Ah, I see what you mean. The reason for this is that the Evaluate dialog works like Eval, not like Execute. So, you get an error for "Dim varname" because Eval("Dim varname") causes an error in VBScript.
To run arbitrary statements, wrap them in Execute():
By the way, unless you use Option Explicit, Dimming variable is optional (although, recommended). If a script uses an unDimmed variable, the VBScript engine will automatically create this variable in the global scope.