V
Victor
I ran the following code under Sheet1, ThisWorkbook and Module1 with no
problem:
Public Sub ShowBarNames()
Dim bar as CommandBar
For Each bar in Application.CommandBars
Debug.Print bar.Name
Next
End Sub
Now, I get an error when the code is inside ThisWorkbook and
CommandBars is not fully qualified, i.e.:
Public Sub ShowBarNames()
Dim bar as CommandBar
For Each bar in CommandBars
Debug.Print bar.Name
Next
End Sub
How come? Isn't Commandbars a global object under Application?
problem:
Public Sub ShowBarNames()
Dim bar as CommandBar
For Each bar in Application.CommandBars
Debug.Print bar.Name
Next
End Sub
Now, I get an error when the code is inside ThisWorkbook and
CommandBars is not fully qualified, i.e.:
Public Sub ShowBarNames()
Dim bar as CommandBar
For Each bar in CommandBars
Debug.Print bar.Name
Next
End Sub
How come? Isn't Commandbars a global object under Application?