Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running procedure from Hidden Project

Status
Not open for further replies.

SgtPepps

IS-IT--Management
May 1, 2002
109
GB
I've a project that occasionaly needs to run a procedure stored in a Project that is loaded during startup of word. Basically i use the code:

Sub FirstProcedure()

Application.Run MacroName:="SecondProcedure"

End Sub

This will run the code in the SecondProcedure however when all of the code within SecondProcedure has run, the code returns to the line that ran SecondProcedure. It will then try to Run SecondProcedure again but gives an error message "Object Required". Does anyone know why it tries to run this specific line twice?

Thanks

Mike
 
Hi Mike

Do you have an error handler routine in your SecondProcedure
Could be it's crashing somewhere in Proc2 on the "Object Required" error, but if the error isn't handled it's handed back to the calling procedure. This would make it *look* like it's trying to run the line twice, but it's actually reporting an error in your second proc

HTH

Cheers
Nikki
 
Hello Nikki

I've stepped through the code in both Proc1 and Proc2, the error dosn't appear until all of the code in Proc2 has run.
I do have a sufficiant work around for this so its not of great importance.

Thanks

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top