Solved

'Executing' a string

Posted on 1998-07-25
2
184 Views
Last Modified: 2010-05-03
Is it possible to save a VB command in a string and then call a function to execute it?  If so, how?
0
Comment
Question by:Egore
2 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
Comment Utility
There is no built in way to do it, but you can write a procedure(a pretty comlicated one) that will parse string commands, and turn then into VB code:

Sub Execute(Command as string, Args as string)
  Dim S1, S2 as string
 If Command = "Name" then
  S1 = Left(Args, instr(args, " "))
  S2 = Right(Args, len(args)-instr(args, " "))
  Name S1 as S2
 End if
 'And so on for every command you wish to implement
   
End Sub

0
 

Expert Comment

by:frankhommers
Comment Utility
You could check out the new Microsoft Scripting Control, it's on the Microsoft site (www.microsoft.com).
It's very easy to implement VBScripting or JScript in your own program! CHECK IT OUT!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now