I would have expected both methods to work (or are you running Excel 2007).
There may be something else in your code that you are doing that is causing
strange results.
In a new workbook include your code to insert new event code, only
CreateEventProcedure(). Adapt along the lines I suggested, in the new
function try with both (but not at the same time) -
Set cbb = Application.CommandBars.FindControl(ID:=1695) ' open the VBE
Set cbb = Application.VBE.CommandBars.FindControl(ID:=578) ' compile
CLOSE the VBE and run your CreateEventProcedure with Alt-F8 (don't forget -
the test is only valid with the VBE closed).
I'd be surprised if either method fails, assuming OK - add back more code
from the main project, testing bit by bit until you hit the problem.
Regards,
Peter T
"Les Stout" wrote in message
...
Hi Peter T, i have inserted and tried, with the same results. I do need
to continue with my code after inserting it, hence the code below.
Sub BBBStdR()
'
On Error Resume Next
CreateEventProcedure
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:02"), "MoveKTLToArchiveR"
End Sub
You also talk about closing the VBE, how would i do that ? Sorry i am
not a trained programmer and still stumbling a bit...
Best regards,
Les Stout
*** Sent via Developersdex http://www.developersdex.com ***