View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kent McPherson Kent McPherson is offline
external usenet poster
 
Posts: 15
Default Adding menu item to Tools

I'd like to add an item to the Tools menu when I open a spreadsheet and then
delete it before the workbook closes. I've tried adding this code to the
Workbook Open event.

Private Sub Workbook_Open()
CommandBars("Worksheet men
bar").Controls("Tools").Controls.Add(Type:=msoCont rolButton).Caption="MyMenu"
End Sub

When I open the spreadsheet, I get an error 91: Object Variable or With
block variable not set.

This same codes works if I include it in the code I have for a userform I've
defined to take inputs from the user.

Ideas?