View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] samadams_2006@yahoo.ca is offline
external usenet poster
 
Posts: 8
Default Late Binding for Excel CommandBar and CommandBarControl

Hello,

I have the following piece of code in an Excel .xla add-in:

---------------------------------------------------------------------------------------------------------------------------

Dim MenuBar As CommandBar
Dim MenuItem As CommandBarControl

Application.CommandBars("Worksheet Menu Bar").Controls("New
Menu").Delete
Set MenuBar = Application.CommandBars("Worksheet Menu Bar")
Set MenuItem = MenuBar.Controls.Add(Type:=msoControlPopup)
MenuItem.Caption = "New Menu"

---------------------------------------------------------------------------------------------------------------------------

This works fine when I have the following Reference checked:

Microsoft Office 11.0 Object Library

Since not all people who will be using this .xla will have this version
of the Object Library, I would like to change this from Early Binding
to Late Binding. Unchecking this Reference gives me numerous problems
when I try to run the program.

Can anyone tell me what the corresponding code would be for "Late
Binding"?

Thanks,
Sam.