I am trying to use InvokeMember to call a function from some code I am compiling on the fly. If I turn Option Strict off and just call the method, it works no problem, so I am guessing there is just something wrong with my InvokeMember call:
VB Code:
Dim oClass As Object Dim tType As Type 'cResult is an assembly that is compiled from the code that I load from a file oClass = cResult.CompiledAssembly.CreateInstance("clsScripting") tType = cResult.CompiledAssembly.GetType("clsScripting") Dim oArguments(1) As Object oArguments(0) = m_App 'oClass.customcode(m_App) tType.InvokeMember("CustomCode", Reflection.BindingFlags.Default Or BindingFlags.InvokeMethod, Nothing, oClass, oArguments)
Here is the code it is compiling:
VB Code:
Class clsScripting Public Sub CustomCode(ByVal objWord As Object) objWord.Selection.TypeText("A") End Sub End Class
Any help would be appreciated.
Thanks,
