Hi, I have Excel 2002 and I can add a dropdown menu to the main menu bar, but the problem is, I want to add a bunch of functions and resources... so I want to add submenus and I have hit a roadblock. My version of Excel's Help lists the command words I'm using as Hidden Language Elements and refuses to help much... the code I'm using consists of 2 arrays called Cap and Mac which contain Captions and Macros strings, and the macros are within the same VBAProject... the main menu is populated like this: With MenuBars(xlWorksheet).Menus(MenuName).MenuItems .Add Caption:=Cap(1), OnAction:=Mac(1) .Add Caption:="-" .Add Caption:=Cap(2), OnAction:=Mac(2) .Add Caption:="-" .Add Caption:=Cap(3), OnAction:=Mac(3) .AddMenu Caption:=subMenuName .Add Caption:="-" .Add Caption:=Cap(4), OnAction:=Mac(4) .Add Caption:="-" (etc.) End With
But I have been unable to populate subMenuName with captions and macros using the With... End With commands. What I get is the submenu caption and the black pointer that indicates a submenu, and a small square beside it with no contents... I have tried to populate the submenu within and outside (before and after the main With ... End With) with code like this (and variations) to no avail: With MenuBars(xlWorksheet).Menus(MenuName).MenuItems.Menus(subMenuName).MenuItems .Add Caption:=Cap(7), OnAction:=Mac(7) .Add Caption:="-" .Add Caption:=Cap(8), OnAction:=Mac(8) .Add Caption:="-" .Add Caption:=Cap(9), OnAction:=Mac(9) End With
If I block the On Error Resume Next line I get errors with this code, specifically: Object doesn't support this property or method (Error 438) Hiliting the code above attempting to populate the submenu. Any hints or help would be appreciated.
|