Is there a way to convert a string to an executable line of code?
sort of:
Dim Line1 as String
Line1 = "MsgBox (""Hello"")"
Execute Line1
as a result, a pop-up window will appear with the message "Hello".
What I am doing is pulling lines from a text file. I can pull out the lines that are the names of the form controls and use them to perform actions on these form controls, but I would like to take another step and execute the lines. I saw statements that this would work:
Application.Run Line1
or make the variable an array and store it in element 1, for example. and use
Application.Run Line1(1)
but it does not work for me.
Well, while writing this, I was also experimenting. I found that
Eval (Line1)
will work when Line1 is a message field, but not when it is something like:
line1 = "DoCmd.OpenForm ""form1"""
Any advice would be appreciated.
thank