help --- Commandbars

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Could someone tell me why
MsgBox Application.CommandBars("Cell").Controls("Insert...").ID
is giving me a invalid procedure call or argument error.

I'm actually trying to disable insert and delete from Cell and Row right
click.

The delete is working fine
Application.CommandBars("Cell").Controls("Delete...").enable = False, but
insert gives me the error....

Help
wAyne_
 
Works fine for me.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
I think you delete it

Run this one time
Application.CommandBars("Cell").Reset

And then try this

Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = False
Application.CommandBars("Cell").FindControl(ID:=292).Enabled = False
 
Hi,

I thought that might be the case -- I had it reset in an earlier part of the
code -- moved it to just before and had the same problems. I then copied
part of the code to a new workbook -- still same result -- even using the IDs
you provided (thanks Ron), I still end up with the same error.....
aaaarrrggghhhh!!

here is my sample code....

Sub test()

Application.CommandBars("Cell").Reset

Application.CommandBars("Cell").FindControl(ID:=292).Enabled = False

Application.CommandBars("Cell").Controls("Delete...").Enabled = False
Application.CommandBars("Cell").Controls("Insert...").Enabled = False

Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = False

End Sub


Thanks
wAyne_
 
Hi wAyne

I think it is time to rename you xlb file and see if it is working then

*************************************************
Maybe you have a corrupt or bloated xlb file *normal* size is < 30 kb.
The .xlb file has all Toolbar customization in it.

1. Close Excel
2. Do a search for .xlb in Windows (Use: search hidden files and folders)
3. Rename or delete the .xlb file or files (In 2002 the name = Excel10.xlb)
4. Start Excel

Deleting the file or renaming will do no harm on your system
Excel will create a new one for you.
(You lost your customization remember that)

If you make your own toolbars or add buttons to the others
this file is important (backup it so you can restore it)
******************************************************

Note: Use only the ID's lines to avoid problems when you send the worksheet to others

See also
http://www.rondebruin.com/menuid.htm
 
Still no luck Ron,

I deleted it - made sure ther wer non - and same problem.

I have tried this ion 2 fdifferent machines - one with 2000 one with 2002..
 
Same as the one aboive --

I copied it to a new spreadhseet -- blank nothign on it -- smae result...

here it is again....
Sub test()

Application.CommandBars("Cell").Reset

Application.CommandBars("Cell").FindControl(ID:=292).Enabled = False

Application.CommandBars("Cell").Controls("Delete...").Enabled = False
Application.CommandBars("Cell").Controls("Insert...").Enabled = False

Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = False

End Sub

It dies on Application.CommandBars("Cell").Controls("Insert...").Enabled =
False
or Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = False if
I comment out the "Insert..." one.....

wAyne_
 
Hi

Do not reset the cell menu each time

Is this working for you ?


Sub test1()
Application.CommandBars("Cell").FindControl(ID:=292).Enabled = False
Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = False
End Sub

Sub test2()
Application.CommandBars("Cell").FindControl(ID:=292).Enabled = True
Application.CommandBars("Cell").FindControl(ID:=3181).Enabled = True
End Sub
 
weird..

it seems to be working --

I tried -- it worked then I tried with reset and it didn't -- continued to
not work,
unti. -- I went into the sheet right clicked on a cell brought up the menu -
-did nothin - went back and it worked.....

I'll try on my main sheet later tonight -- hopefully removing the reset
will work there as well...

Thanks for the help....
wAyne_
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top