I am new to VB but not new to development and I have come across something that I would like to do. I want to store as a string the following command:

tCommand = ".width <= 36 then wqty = 1 else wqty 2"

Now when I do my coding I want to read that string and execute it as such

If tCommand$
end if

Is that possible?

Thanks

Charles

No, it's not possible.

If tCommand$
end if

is not a valid statement in VB6 so you can't get the code through the compiler.
Neither

tCommand = ".width <= 36"
If tCommand$ Then
  wqty = 1
Else
 wqty = 2
end if

works because Visual Basic does not have any Eval function (something similar to JavaScript's Eval function) unless you write your own Eval() function. You may try some googling, there has been coded some Eval-like functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.