This really seems to be a bug in Excel 97, because even if I just have a simple msgbox in the sub it's called twice.
I noticed this one only happening when you use a macro that has a parameter. I don't think you are supposed to use a sub with a parameter in a toolbar (as this is not really necessary, because the parameter won't change itself anyway, and, hey, they aren't even listed there).
So why don't create some "call-subs". For each button, assign it's on sub that calls you main sub with the appropriate parameter.
Sub Button1
MyMacro (1)
End Sub
Sub Button2
MyMacro (2)
End Sub
...
By the way, I did not find any bugfix for this one and I guess that's just because there is none. (I don't think that many people really need this
Main Topics
Browse All Topics





by: brettdjPosted on 2003-08-19 at 21:50:58ID: 9185806
Presumably you have debugged the macro and you know when it fires a second time. When does the second run happen and what is different during the second run that stops it running a third time?
Do you have any events that are triggerred when the macro runs? If you do then throw in an Application.Events = False at the start of the macro to disable the events but remember to reenable them at the end of your code.
Cheers
Dave