My problem is i can execute one line of code using:
'*************************************
Private Declare Function EbExecuteLine Lib "vba6.dll" (ByVal pStringToExec As Long, ByVal Unknownn1 As Long, ByVal Unknownn2 As Long, ByVal fCheckOnly As Long) As Long
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
'*************************************[/color blue]
but i cant sem to work out a way to execute more than one lineof code as a whole, eg an if statement. is there eny way this could be donw at run-time using this executeline api, or is there another api for the job?
thanks in advance.
'*************************************
Private Declare Function EbExecuteLine Lib "vba6.dll" (ByVal pStringToExec As Long, ByVal Unknownn1 As Long, ByVal Unknownn2 As Long, ByVal fCheckOnly As Long) As Long
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
'*************************************[/color blue]
but i cant sem to work out a way to execute more than one lineof code as a whole, eg an if statement. is there eny way this could be donw at run-time using this executeline api, or is there another api for the job?
thanks in advance.