Solved

'Executing' a string

Posted on 1998-07-25
2
198 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA: Add rows to listbox based on criteria 7 73
Need VBS version of Excel date conversion 4 64
VB error "Type mismatch" 2 49
How does CurrentUser work? 10 31
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

919 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

18 Experts available now in Live!

Get 1:1 Help Now