Thread: Code Crashing
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Code Crashing

Well let me nitpick it...
Use Option Explicit as the first line in the module.
Make sure the code is in a standard module.
Use Application.CommandBars instead of CommandBars
Declare the i variable... Dim i as Long
Declare MenuArray as an array... Dim MenuArray() as Long

Try your code without using the myIndex variable.
All of the new menu items will then be added to the bottom of the menu.
Don't run your code in Page Break Preview mode.
There is a separate right-click "Cell" menu that functions there.

I would also have two separate subs, one to delete the menus and
one to add the menus.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"John"

wrote in message
When I run the following code it sometimes crashes on the first line
after the for loop start. The code adds/removes some menu items from
the 3 cell right click menus(There are 3 right click cell menus, one
for when a cell or area of cells are selected, one for entier row(s)
selected, and one for entire column(s) selected). I can get it to run
the line of code by debugging, then making the particular menu show
once, and then resuming the code. I can't get the error to repeat
consistently. Any ideas are appreciated. Thanks.

-snip-