Removing Items from Word 2007 right-click menu

B

BrianBr

I downloaded the "Smart Tags" from DataPortal as listed on the More Smart
Tags link page. It did not do what I wanted so I removed the program.
However, it added 12 items to the right click menu and removing the program
did not remove the menu items.

DataPortal has not responded to my emails and their telephone number is
disconnected. Microsoft might want to rethink having them listed on that page.

AND

How do I get rid of these annoying right-click menu items?
 
B

Bill Mitchell

Hi,

What fascinates me about your post is the fact the program was able to
change the right-click shortcut menu. I've been trying to find out how to do
that for weeks now and no one seems to know. M$, in their infinite wisdom,
decided no one ever needed to customize shortcut menus any more, so they
removed that fucntionality from Word 2007.
 
S

Summer

I run Word 2003 /2007 and I have 4 (four) Paste Specials in my right click
menu using below code - I'd like to delete (3) of them. Is below code what
you are after - needs refining as when it calls it ends up creating 4 Paste
Special which I cannot delete

Sub AutoExec()
Call AddPasteSpecial
End Sub

Sub AddPasteSpecial()
Dim cb As CommandBar
Dim c As CommandBarButton
Set cb = Application.CommandBars("Text")
Set c = cb.FindControl(, , "VBAxPasteSpec")
If c Is Nothing Then
Set c = cb.Controls.Add(msoControlButton, 755, , 4, True)
With c
.Caption = "Paste &Special..."
.Style = msoButtonCaption
.TooltipText = "Paste Special"
.Tag = "VBAxPasteSpec"
End With
End If
End Sub
 
J

Jay Freedman

I ran that code in 2007, and it creates only one Paste Special.
Examining the code, there's no reason it should insert four, or any
number greater than one. After the first one exists, the FindControl
should find it, and the line "If c Is Nothing Then" should bypass the
creation of another one.

However, you can try replacing the line

Set c = cb.FindControl(, , "VBAxPasteSpec")

with

Set c = cb.FindControl(, 755)

which might work better for you.

It will be much more effective to figure out why you're getting too
many copies, rather than deleting the extra ones once they're there.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
B

Bill Mitchell

Hi guys.

Ok, I have some macros that do some formatting for me (paragraphs and
bullets) that I would sure like to add to the current shortcut menu on Word
2007 documents.

Let's say my macro is called "AddBullets" and it is located in the Normal
Template. What code would I run to add that to my shortcut menu? How do I
control where it shows up on the menu?
 
J

Jay Freedman

Here's some sample code to put an item on the Text context menu to run
the AddBullets macro; it assumes that the AddBullets macro and this
AutoExec macro are both in Normal.dotm. The .OnAction property is the
one that specifies which macro to run when the menu item is clicked;
the .Tag property is just an arbitrary string that can be used as a
sort of name for the item.

The Before parameter of the Controls.Add method is the numeric
position where the item will be added.

Sub AutoExec()
Dim cb As CommandBar
Dim ctl As CommandBarButton
On Error GoTo bye

CustomizationContext = NormalTemplate
Set cb = CommandBars("Text")
Set ctl = cb.FindControl(Tag:="AddBullets")
If ctl Is Nothing Then
Set ctl = cb.Controls.Add(Type:=msoControlButton, _
Before:=9, Temporary:=True)

With ctl
.Caption = "A&dd bullets"
.Tag = "AddBullets"
.OnAction = "AddBullets"
End With
End If
bye:
End Sub

If you want to remove the item from the menu, you can do it like this:

Sub RemoveAddBullets()
Dim cb As CommandBar
Dim ctl As CommandBarControl
CustomizationContext = NormalTemplate
Set cb = CommandBars("Text")

For Each ctl In cb.Controls
If ctl.Tag = "AddBullets" Then
ctl.Delete
End If
Next
End Sub

A somewhat different approach is given in the article "How to:
Customize an Item Context Menu"
<http://office.microsoft.com/client/...ORD.DEV&lcid=1033&CTT=3&Origin=HV100389221033>

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
J

Jay Freedman

Oh yeah,

And I need to add this to the Tables Shortcut Menu as well.

There isn't just one Tables context menu. Here's the list:

Table Cells
Table Headings
Table Lists
Table Pictures
Table Text
Whole Table
Linked Table

You'll have to add the commands to each one that you want to use them
on -- probably at least Table Cells, Table Text, and Whole Table.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
B

Bill Mitchell

Many thanks Jay! Exactly what I was after. You'd be surprised how hard it
was to find that simple code anywhere in M$'s Help Documentation - lol, well,
on second thought, M$'s Help Screen not being very "helpful" probably
wouldn't surprise anyone :)

Come on over to Experts Exchange - we need you!
 
B

BrianBr

Thanks Bill (and thanks M$ for nothing!),

I have found that one way to reset the menu is uninstall and re-install
Word, but I was hoping to avoid that :-(
 
B

BrianBr

Bill,

If it is any help, I have just talked to a M$ rep and found out how to reset
the Right-Click Menu to original Default form.

------------------------------------
Close all MS Office Apps including Outlook.

In regedit, HKEY_CURRENT_USER, go to Software-Microsoft-Office-12.0-Word.
Rename Data to OldData
Rename Options to OldOptions
Close Regedit

In RUN (Start Menu) enter %appdata%
Goto Microsoft/Templates and make a back up of this folder.
Erase folder contents.

Start Word and the right-click menu should be reset to default
------------------------

It is evident that the manipulation takes place in the Data and Options
folders in Regedit and that makes permanent changes to the Normal.dotm file.
Maybe from that you can figure out how to create what you want in the
right-click menus.

Hope this helps.
 

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

Top