Programming with Reflection
CompileScript method
Syntax ErrorCode = object.CompileScript(ScriptName)
Compiles a Reflection Basic script.
ScriptName Argument type: String
Required
Specifies a Reflection Basic script to compile. Supply complete path information if the script isn't on the Reflection macro path. If ScriptName specifies a plain text file, the file is automatically converted to the Reflection Basic script format.
ErrorCode Return type: Integer
The numeric error code from the compilation: 0 if the script was successfully compiled (contained no syntax errors), or a non-zero error value. Use the Error$ statement to return the equivalent error message:
Sub Demo ()
Dim x As Long
x = Session.CompileScript("C:\onions.rbs")
MsgBox "Error #" & x & ", " & Error$(x)
End Sub