Solved

'Executing' a string

Posted on 1998-07-25
2
217 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1466665
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
ID: 1466666
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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