Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Lost my Command Menus - Please Help

Could someone please help with unexpected side-effect after running the
following code:

Dim oCtrl As Object

With Application.CommandBars("Cell")

'Clear the existing menus
For Each oCtrl In .Controls
oCtrl.Delete
Next oCtrl

End With

When I right-click on any cell in my worksheet, I am unable to bring up
a command pop-up menu. What I get is a small blue-coloured rectangle
instead of a command pop-up menu. I then press the Esc - key to remove
the blue-coloured rectangle.

I even tried right-clicking on a new worksheet and the same
blue-coloured rectangle keep appearing.

Could some please advise on how I can reverse this situation?

Kind regards,

Chris.

Live Long and Prosper :-)

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Lost my Command Menus - Please Help

Chris,
What about this from the immediate window:
Application.CommandBars("Cell").Reset

NickHK

"Chris Hankin" wrote in message
...
Could someone please help with unexpected side-effect after running the
following code:

Dim oCtrl As Object

With Application.CommandBars("Cell")

'Clear the existing menus
For Each oCtrl In .Controls
oCtrl.Delete
Next oCtrl

End With

When I right-click on any cell in my worksheet, I am unable to bring up
a command pop-up menu. What I get is a small blue-coloured rectangle
instead of a command pop-up menu. I then press the Esc - key to remove
the blue-coloured rectangle.

I even tried right-clicking on a new worksheet and the same
blue-coloured rectangle keep appearing.

Could some please advise on how I can reverse this situation?

Kind regards,

Chris.

Live Long and Prosper :-)

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Lost my Command Menus - Please Help

Hi again Chris -

To solve the problem immediately:

If you used the following to turn off the shortcut menu, type the following
into the VBA Immediate Window (and press Enter to run it):
CommandBars("Cell").Enabled = True

If you used the oCtl.Delete approach to turn off the shortcut menu, type the
following into the VBA Immediate Window (and press Enter to run it):
CommandBars("Cell").Reset
----------------------------------------------
Insert either of these lines (as appropriate) at a strategic location in
your VBA code, such as in the Workbook_Close module (or sooner), so that the
menus will be re-enabled as soon as you're done with your application
(review the original post on the subject concerning re-enabling).

There's nothing worse than losing menus and commands ! Sorry I didn't
emphasize the re-enabling more aggresively. I hope it didn't turn out to be
too much of an adventure for you...
--
Jay


"Chris Hankin" wrote:

Could someone please help with unexpected side-effect after running the
following code:

Dim oCtrl As Object

With Application.CommandBars("Cell")

'Clear the existing menus
For Each oCtrl In .Controls
oCtrl.Delete
Next oCtrl

End With

When I right-click on any cell in my worksheet, I am unable to bring up
a command pop-up menu. What I get is a small blue-coloured rectangle
instead of a command pop-up menu. I then press the Esc - key to remove
the blue-coloured rectangle.

I even tried right-clicking on a new worksheet and the same
blue-coloured rectangle keep appearing.

Could some please advise on how I can reverse this situation?

Kind regards,

Chris.

Live Long and Prosper :-)

*** Sent via Developersdex http://www.developersdex.com ***

  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Lost my Command Menus - Please Help

Also, check out the renewed activity on your original post on the subject
(2/27)...
--
Jay


"Chris Hankin" wrote:

Could someone please help with unexpected side-effect after running the
following code:

Dim oCtrl As Object

With Application.CommandBars("Cell")

'Clear the existing menus
For Each oCtrl In .Controls
oCtrl.Delete
Next oCtrl

End With

When I right-click on any cell in my worksheet, I am unable to bring up
a command pop-up menu. What I get is a small blue-coloured rectangle
instead of a command pop-up menu. I then press the Esc - key to remove
the blue-coloured rectangle.

I even tried right-clicking on a new worksheet and the same
blue-coloured rectangle keep appearing.

Could some please advise on how I can reverse this situation?

Kind regards,

Chris.

Live Long and Prosper :-)

*** Sent via Developersdex http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Lost my Command Menus - Please Help

Thanks NickHK and Jay for all your help - very much appreciated. Sorry
It has taken so long to get back to you, but my son very sick and is in
hospital. He is only now getting better.

Cheers,

Chris.

Live Long and Prosper :-)

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lost my drop down menus - where are they? tripodjim Excel Discussion (Misc queries) 3 December 5th 08 04:53 PM
Lost Menus & Toolbars with Right Click macro - HELP? Silena K-K Excel Discussion (Misc queries) 0 December 11th 07 10:45 PM
Menus / Links associated with right-mouse-click lost! adnessoz Excel Discussion (Misc queries) 3 August 24th 06 11:41 PM
I have lost my menus and tools Lina Excel Discussion (Misc queries) 3 November 25th 05 01:26 PM
Lost the menus on right mouse click ETF Excel Programming 3 November 6th 05 06:26 AM


All times are GMT +1. The time now is 11:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"