View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Called macro runs twice in excel 2002

what fires the original macro? Is it tied to an event? I would put a
msgbox in the original macro just before the run command and see if the
original macro is running twice as well.

--
Regards,
Tom Ogilvy

"Martin French" wrote in message
...
Hi Everyone. This one really has me stumped but I'm sure
the answer is dead simple. I have written a macro in one
spreadsheet which then calls a macro from another. The
control then passes back to the original macro. It was
created in XL97 under windows98SE. My machine has now been
upgraded to XP and XL2002. When I run the macro now, it
runs the called procedure twice before returning to the
original coding. Does anyone know why this happens and is
there a way to stop it?

I have simplified the code for the purpose of
demonstrating this unusual behaviour.
The line of code in the main macro which calls the
secondary macro is:

application.run "2ndplacedatabase_sept_2003.xls!dummymacro
()"
End

The code in the secondary sheet is:

Sub dummymacro()
MsgBox "Now in the dummy macro"
End Sub

When I run this simple code the message box in the
secondary macro appears twice before control passes back
to the main macro.

Many Thanks to anyone who can help