When running excel VBA under VB control a compile error opens the VBE window, flags the offending line and stops with a message box. I would like to trap such errors before these actions occur.
Dim objVBECommandBar As Object
Set objVBECommandBar = Application.VBE.CommandBar
Set compileMe = objVBECommandBar.FindControl(Type:=msoControlButton, ID:=578)
compileMe.Execute