|
|
Title | Execute a line of code stored in a string |
Keywords | execute line, VBA, vba6.dll, vba5.dll, vba332.dll |
Categories | Software Engineering |
|
|
Thanks to Sergio Perciballi.
Use the EbExecuteLine API function in vba6.dll, vba5.dll, or vba332.dll.
|
|
Function FExecuteCode(stCode As String, Optional fCheckOnly _
As Boolean) As Boolean
FExecuteCode = EbExecuteLine(StrPtr(stCode), 0&, 0&, _
Abs(fCheckOnly)) = 0
End Function
Private Sub Command1_Click()
Dim res As Boolean
res = FExecuteCode(Text1.Text)
Label1.Caption = "Status = " & res
End Sub
|
|
|
|
|
|