D
Dan Kelly
I am trying to get my head around Private declarations and AutoNew/AutoOpen
options.
I have the following code that works:
Option Explicit
Dim cb As CommandBarComboBox
Sub AutoNew()
SetComboBox
End Sub
Private Sub SetComboBox
Set cb = CommandBars("Test").Controls.Add(msoControlComboBox)
with cb
.OnAction = "SetColour"
.AddItem "Green"
' Other setup stuff that works....
End With
End Sub
Private Sub SetColour
Select Case cb.Text
Case "Green"
'Run another Macro that doesn't matter here
EndSub
If however I declare AutoNew as Private so that it is hidden from the Macro
list then the above breaks at the Select Case Statement.
Where am I going wrong?
options.
I have the following code that works:
Option Explicit
Dim cb As CommandBarComboBox
Sub AutoNew()
SetComboBox
End Sub
Private Sub SetComboBox
Set cb = CommandBars("Test").Controls.Add(msoControlComboBox)
with cb
.OnAction = "SetColour"
.AddItem "Green"
' Other setup stuff that works....
End With
End Sub
Private Sub SetColour
Select Case cb.Text
Case "Green"
'Run another Macro that doesn't matter here
EndSub
If however I declare AutoNew as Private so that it is hidden from the Macro
list then the above breaks at the Select Case Statement.
Where am I going wrong?