Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same sub in two modules, wrong one gets called?
I have two modules, production and testing. I have a menu bar with
buttons on it, which is populated in code like this: Sub AddButton(barName As String, buttonName As String, commandName As String) Set newbutton = Application.CommandBars(barName).Controls.Add (Type:=msoControlButton) With newbutton .OnAction = commandName .Caption = buttonName .Style = msoButtonCaption .Visible = True End With End Sub I am adding buttons to the bar like this: Call AddButton("STAT", "Imply parameters", "testing.xla!Solve") In spite of the name being fully qualified with the correct module name, this button continues to call the version of Solve in "production.xla". It's very annoying. Any advice? Maury |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same sub in two modules, wrong one gets called?
Try this:
Application.CommandBars(barName).Reset Then run your AddButton code again. RBS "Maury Markowitz" wrote in message ... I have two modules, production and testing. I have a menu bar with buttons on it, which is populated in code like this: Sub AddButton(barName As String, buttonName As String, commandName As String) Set newbutton = Application.CommandBars(barName).Controls.Add (Type:=msoControlButton) With newbutton .OnAction = commandName .Caption = buttonName .Style = msoButtonCaption .Visible = True End With End Sub I am adding buttons to the bar like this: Call AddButton("STAT", "Imply parameters", "testing.xla!Solve") In spite of the name being fully qualified with the correct module name, this button continues to call the version of Solve in "production.xla". It's very annoying. Any advice? Maury |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same sub in two modules, wrong one gets called?
On Feb 19, 7:09*am, "RB Smissaert"
wrote: Try this: * Application.CommandBars(barName).Reset Method "Reset" of object "CommandBar" failed. What does the help mean when it says "Resets a built-in command bar to its default configuration". What is the "default configuration"? Maury |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop VB from deleting modules from wrong file | Excel Programming | |||
Excel-called Dotnet DLL is using wrong Framework | Excel Programming | |||
Public, Private, Event modules, Forms modules,,, | Excel Programming | |||
Basic question - modules and class modules - what's the difference? | Excel Programming | |||
Data form Dates wrong when called from macro? | Excel Programming |