'------------------------------------------
' (c) 1999 Trigeminal Software, Inc. All Rights Reserved
'------------------------------------------
'Thanks to ----------michka - Michael Kaplan
'Rest of code by Sergio Perciballi -oigres P (Aug-6-2000)
'Uses the function used by the immediate window
'to execute a line of code.
Option Compare Text
Option Explicit
Private Declare Function EbExecuteLine Lib "vba6.dll" _
(ByVal pStringToExec As Long, ByVal Foo1 As Long, _
ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
' For VB5 IDE
'Declare Function EbExecuteLine Lib "vba5.dll" _
'(ByVal pStringToExec As Long, ByVal Foo1 As Long, _
'ByVal Foo2 As Long, ByVal fCheckOnly As Long) As Long
' FOR Access 97/VBE.dll clients like Word 97 and Excel 97
'Declare Function EbExecuteLine Lib "vba332.dll" _
'(ByVal pStringToExec As Long, ByVal Foo1 As Long, _
'ByVal Foo2 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
'Usage
Private Sub Command1_Click()
FExecuteCode "End"
End Sub