Popup Menu

  • Thread starter Thread starter FuzzyLogic
  • Start date Start date
F

FuzzyLogic

I want to Add my own menu within the popup menu of the excel.
so that user can choose the functionality which I have provide by righ
clicking any cell of the sheet.

Any One can help me................
 
Fuzzy,

Here is an example

Sub addRightClick()
Dim oCtl As Office.CommandBarControl
With Application.CommandBars("cell")
On Error Resume Next
.Controls("myFunction").Delete
On Error GoTo 0
.Controls("Insert Comment").Visible = False
Set oCtl = .Controls.Add(temporary:=True)
With oCtl
.BeginGroup = True
.Caption = "myFunction"
.OnAction = "myMacro"
End With
End With
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
http://support.microsoft.com/default.aspx?scid=kb;en-us;166755
File Title: Customizing Menu Bars, Menus, and Menu Items in Microsoft(R)
Excel 97
File Name: WE1183.EXE
File Size: 58041 bytes
File Date: 06/20/97
Keywords: kbfile kbappnote
Description: This Application Note can help you learn techniques for writing
Visual Basic(R) for Applications code to customize menus in Microsoft Excel
97. This Application Note contains code examples that you can use with the
following elements: menu bars, menus, menu items, submenus, and shortcut
menus.


http://support.microsoft.com/?id=213209
XL2000: Sample Macros that Customize and Control Shortcut Menus

http://support.microsoft.com/?id=162878
XL97: Sample Macros That Customize and Control Shortcut Menus


Previous post by Andy Wiggins:
This file might be a help:
http://www.bygsoftware.com/examples/zipfiles/PopUpMenuDemo.zip
It's in the "Menu Routines" section on page:
http://www.bygsoftware.com/examples/examples.htm

Demonstrates how to create and implement a popup menu.
The workbook covers two areas:
* Creating a popup menu
* Using the Right_Click event

The code is open and commented.


--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"

-----
Previous Post by Ron de Bruin

If you mean the menu if you right click on a cell then try this

Sub AddToCellDropDown()
Dim CellDropDown As CommandBar
Dim MyDropDownItem As CommandBarControl

RemoveFromCellDropDown

Set CellDropDown = Application.CommandBars("Cell")
With CellDropDown.Controls.Add(Type:=msoControlButton, before:=1)
.Caption = "Try me"
.Style = msoButtonIconAndCaption
.FaceId = 59
.OnAction = ThisWorkbook.Name & "!Your_macro"
.Tag = "MyDropDownItem"
End With
End Sub

Sub RemoveFromCellDropDown()
Dim MyDropDownItem As CommandBarControl
Set MyDropDownItem =
Application.CommandBars.FindControl(Tag:="MyDropDownItem")
If Not MyDropDownItem Is Nothing Then
MyDropDownItem.Delete
End If
Set MyDropDownItem = Nothing
End Sub

Sub Your_macro()
MsgBox "Hi there."
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
 
Extremely Thanx to Bob,

I works now.


Can please tell me about my previous post.

Installing AddIns through VB Application.


Regards.


Fuzz
 
Back
Top