View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Execute a variable as an insertion into a VBA code line

I think you are going to have to run X thru a Select Case statement.

Select Case True
Case Instr(1, X, "Test",vbTextCompare) 0 Then
Call MyToolsObject.Test
Case Instr(1, X, "Sludge",vbTextCompare) 0 Then
Call MyToolsObject.Sludge
End Select
--
Your chances of getting something consistently useful from user input may be pretty slim.
You are probably going to have to validate it against an array of correct/acceptable answers.
'--
Jim Cone
Portland, Oregon USA
(Review of the Special Sort add-in... http://www.contextures.com/excel-sort-addin.html )





wrote in message ...
2003 & 2007
Is there a way to obtain, via Inputbox, to run the code line below:
"MyToolsObject.Test"
X = "MyToolsObject." & Application.InputBox("VB.NET File to test: ", "ENTER PROCEDURE NAME")
Assume: X = "MyToolsObject.Test "
Effectively, how can I "Execute" X as if it were the codeline below?

Sub DecodeRunDLL()'
Dim MyToolsObject As ToolsNET.Tools
Set MyToolsObject = New ToolsNET.Tools
MyToolsObject.Test ' <<<<< *********** How Execute "X"
Set MyToolsObject = Nothing
End Sub

TIA EagleOne