Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Removing Items from Word 2007 right-click menu

1,977 views
Skip to first unread message

BrianBr

unread,
Jul 6, 2007, 10:38:00 AM7/6/07
to
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?

Bill Mitchell

unread,
Jul 6, 2007, 9:56:01 PM7/6/07
to
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.

Summer

unread,
Jul 7, 2007, 6:55:08 AM7/7/07
to
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

"Bill Mitchell" <BillMi...@discussions.microsoft.com> wrote in message
news:4DDC9AD9-E234-4FB3...@microsoft.com...

Jay Freedman

unread,
Jul 7, 2007, 8:59:51 AM7/7/07
to
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 FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Bill Mitchell

unread,
Jul 7, 2007, 3:12:03 PM7/7/07
to
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?

Bill Mitchell

unread,
Jul 7, 2007, 3:18:03 PM7/7/07
to
Oh yeah,

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

Jay Freedman

unread,
Jul 7, 2007, 7:10:29 PM7/7/07
to
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/helppreview.aspx?AssetID=HV100452721033&ns=WINWORD.DEV&lcid=1033&CTT=3&Origin=HV100389221033>

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Jay Freedman

unread,
Jul 7, 2007, 7:16:09 PM7/7/07
to
On Sat, 7 Jul 2007 12:18:03 -0700, Bill Mitchell
<BillMi...@discussions.microsoft.com> wrote:

>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.

Bill Mitchell

unread,
Jul 7, 2007, 8:26:04 PM7/7/07
to
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!

Summer

unread,
Jul 7, 2007, 9:09:39 PM7/7/07
to
What can I say "it thinks I'm special" - you're the VBA guru not I.

Thank you.

"Jay Freedman" <jay.fr...@verizon.net> wrote in message
news:a53v83pb2ndmlaq1u...@4ax.com...

BrianBr

unread,
Jul 9, 2007, 11:18:04 AM7/9/07
to
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 :-(

BrianBr

unread,
Jul 18, 2007, 11:08:02 AM7/18/07
to
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.

0 new messages