Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

edit right click popup menu 1

Status
Not open for further replies.

RodP

Programmer
Joined
Jan 9, 2001
Messages
109
Location
GB
Hi,

Does anyone know how to edit the popup menu which appears when you click on the right hand mouse button? I have created a macro and would like it to be available from this particular menu.

Hope someone can help

Many thanks in advance

Rod
 
In MSWord

Tools-->Customize
Check the box next to 'Shortcut Menus' in the Toolbars list
You can edit these menus just like any other menu

for Excel, ???
 
Thanks Justin,

However, I don't have the 'Shortcut Menu' in the list to check. Any ideas?

Rod
 
What version of MS Word are you using?
I only have MS Word 97 here.
 
Want to use it in MS Excel 97

Would it have been hidden at all?

Rod
 
don't have time now (have to go get drunk; Friday night here) but you could have a look at the following topics in Excel help

1. Adding and displaying shortcut menus
2. Adding and managing menu bars and menu items
 
the sub 'AddButton' adds a button 'my button' to the menu that pops-up when you right-click on a cell or a selection of cells (at least on my machine (Excel 97))

clicking on this button runs the sub 'RunThis'

Code:
Option Explicit

Sub AddButton()
  Dim oButton As CommandBarButton
  
  Set oButton = CommandBars("Cell").Controls.Add(msoControlButton, , , , True)
  
  With oButton
    .Caption = "my button"
    .DescriptionText = "this is my button"
    .Enabled = True
    .OnAction = "RunThis"
    .TooltipText = "tool tip text for my button"
    .Visible = True
  End With
End Sub

Sub RunThis()
  MsgBox Application.Selection.Address
End Sub
 
Hi Guys,

It's been some time since writing but none the less I hope it's a sign that I'm actually improving a little! Anyhow, I just want sort something out relating to this thread. I've created a button in the right click pop up menu you get when you select a cell in excel to paste transpose (for example). I'm working in one sheet but with two windows. I tranpose the data I have highlighted and copied into the second window. However the position in the first window jumps to where I am pasting in the second window! This is a little annoying and so I'd like to know if there is some extra code which would prevent this?

Alternatively, I could use a second workbook but that's sidelining the problem and i'd like to continue to learn about VBA.

Thanks very much in advance! :)

Rod

Below is the code I'm using (Thanks to JustinEzequiel for the help!) :)

--------------

Option Explicit

Sub AddButton()
Dim oButton As CommandBarButton

Set oButton = CommandBars("Cell").Controls.Add(msoControlButton, , , , True)

With oButton
.Caption = "Paste Transpose"
.DescriptionText = "Paste transpose"
.Enabled = True
.OnAction = "Paste_transpose"
.TooltipText = "See module in Personal.xls"
.Visible = True
End With
End Sub

Sub Paste_transpose()
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top