G
Guest
Hi,
I'm trying to get a handle on coding for Command Bars, a very tricky subject
to say the least. I thought I had it down but every time I tried to use code
to create a CommandBar, I got the infamous ("Invalid Procedure Call") error
message.
So in despair I tried copying a Command Bar code right form MS website.
When I tried to run that I got the same message. Here's the code:
Sub testAddModifyToolbars1()
Dim myBar as CommandBar
Dim oldcontrol as CommandBarControl
Set mybar = CommandBars _
.Add(Name:="ChangingButton", Position:=msoBarTop, _
Temporary:=True)
mybar.Visible = True
Set oldcontrol = mybar.Controls _
.Add(Type:=msoControlButton, _
ID:=CommandBars("Standard").Controls("Copy").ID)
oldcontrol.OnAction = "changeFaces"
End Sub
Can someone tell me whats wrong and why even MS's code doesnt seem to work?
Thanks,
Bill
I'm trying to get a handle on coding for Command Bars, a very tricky subject
to say the least. I thought I had it down but every time I tried to use code
to create a CommandBar, I got the infamous ("Invalid Procedure Call") error
message.
So in despair I tried copying a Command Bar code right form MS website.
When I tried to run that I got the same message. Here's the code:
Sub testAddModifyToolbars1()
Dim myBar as CommandBar
Dim oldcontrol as CommandBarControl
Set mybar = CommandBars _
.Add(Name:="ChangingButton", Position:=msoBarTop, _
Temporary:=True)
mybar.Visible = True
Set oldcontrol = mybar.Controls _
.Add(Type:=msoControlButton, _
ID:=CommandBars("Standard").Controls("Copy").ID)
oldcontrol.OnAction = "changeFaces"
End Sub
Can someone tell me whats wrong and why even MS's code doesnt seem to work?
Thanks,
Bill