MajorTom
10-12-2004, 02:18 PM
Split from this rather old thread (http://www.xtremevbtalk.com/showthread.php?t=141357).
Please don't re-open threads that have been inactive for more than a couple of weeks - start a new thread instead.
First of all, thanks for providing that code. It's just what I needed and works great. I'm having trouble, however when turning Option Strict On.
The problem occurs on the following line:
cbTarget = cbcParant.Controls.add(Type:=MsoControlType.msoControlButton)
The error is "Option Strict On disallows late binding". I was able to appease the compiler by changing the line to:
cbTarget = CType(cbcParant.Parent.Controls.Add(Type:=MsoControlType.msoControlBut ton), CommandBarButton)
Unfortunately this changes the behavior of the toolbar. With the code change all calls to CreateMenuItem creates a menu item on the main toolbar and not the one created in code.
Major Tom
Please don't re-open threads that have been inactive for more than a couple of weeks - start a new thread instead.
First of all, thanks for providing that code. It's just what I needed and works great. I'm having trouble, however when turning Option Strict On.
The problem occurs on the following line:
cbTarget = cbcParant.Controls.add(Type:=MsoControlType.msoControlButton)
The error is "Option Strict On disallows late binding". I was able to appease the compiler by changing the line to:
cbTarget = CType(cbcParant.Parent.Controls.Add(Type:=MsoControlType.msoControlBut ton), CommandBarButton)
Unfortunately this changes the behavior of the toolbar. With the code change all calls to CreateMenuItem creates a menu item on the main toolbar and not the one created in code.
Major Tom