Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Context menu


Hi,
Is it possible to have a right click menu display when you right clic
on an object such as a VB combobox? I can get the menu to appear whe
right clicking on a cell but not on a combobox.

Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("cell").Controls.Add
With NewControl
.Caption = "Clear Combo"
.OnAction = "Clear"
.BeginGroup = True
End With

Many thank

--
cmpcwil
-----------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341
View this thread: http://www.excelforum.com/showthread.php?threadid=55025

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Context menu

This will show your customized "cell" menu upon right-clicking on the combo.

Private Sub ComboBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
CommandBars("cell").ShowPopup
End If
End Sub

HTH
--
AP

"cmpcwil2" a écrit
dans le message de news:
...

Hi,
Is it possible to have a right click menu display when you right click
on an object such as a VB combobox? I can get the menu to appear when
right clicking on a cell but not on a combobox.

Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("cell").Controls.Add
With NewControl
Caption = "Clear Combo"
OnAction = "Clear"
BeginGroup = True
End With

Many thanks


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile:
http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=550257



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Context menu


Thank you thats great, don't why I didn't try that! Thanks agai

--
cmpcwil
-----------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...fo&userid=3341
View this thread: http://www.excelforum.com/showthread.php?threadid=55025

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Context menu


I have a context menu to appear upon a right click of the mouse whilst
on a combo box. However the menu appears twice once when you right
click and then again upon selection of a menu item, I have implemented
the code above in a class module so not sure if this is the problem,
here is my code:

set up menu in module:

Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("cell").Controls.Add
With NewControl
..Caption = "Clear Combo"
..BeginGroup = True
End With

call the menu from class module depending upon which combo box has
focus:
Sub ComboGroup_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

If Button = 2 Then
CommandBars("cell").ShowPopup
ComboGroup.Text = ""
ComboGroup.clear


End If
End Sub

Can anyone help me on this? thanks


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=550257

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
Add items to context menu Fred Jacobowitz Excel Worksheet Functions 1 April 22nd 06 10:29 PM
Context menu of Cell MadDog Excel Programming 2 March 4th 06 10:30 AM
Context Menu nrussell Excel Programming 0 September 29th 05 10:08 AM
Context menu on userform Matthew Excel Programming 3 May 26th 05 02:32 AM
context menu eric23 Excel Programming 3 May 9th 04 11:49 PM


All times are GMT +1. The time now is 08:16 PM.

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

About Us

"It's about Microsoft Excel"