|
-
Apr 22nd, 2011, 03:33 PM
#1
Thread Starter
New Member
Evaluate a string as vba command??
Hi,
How can i do:
Code:
A = "msgbox " & chr(34) & "Hello" & chr(34)
ProcEvaluate(A)
and have VBA to evaluate the string A as a VBA command?
Evaluate is a common procedure in programming languages.
Is VBA lacking it?
Thanks
-
Apr 22nd, 2011, 03:46 PM
#2
Fanatic Member
Re: Evaluate a string as vba command??
-
Apr 22nd, 2011, 03:56 PM
#3
Thread Starter
New Member
Re: Evaluate a string as vba command??
Thanks,
but Application.Run seems only to run macros.
Is there a way to run chunks of code?
-
Apr 22nd, 2011, 04:00 PM
#4
Thread Starter
New Member
Re: Evaluate a string as vba command??
Let me rephrase.
Suppose you want to create variables
A1
A2
A3
An
via FOR loops where i=1 to n
How would you do?
-
Apr 22nd, 2011, 04:39 PM
#5
Fanatic Member
Re: Evaluate a string as vba command??
That's really script-like. Much like languages that support syntax like "/echo {A{1}}" type expressions. VBA is not that kind of language. You'll want to use arrays and enumerations.
-
Apr 23rd, 2011, 06:35 AM
#6
Re: Evaluate a string as vba command??
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|