Solved

Add Change Case to Right Click

Posted on 2006-11-27
13
265 Views
Last Modified: 2008-02-01
Hi All,

I'd like to add the menu item Format, Change Case to my right-click context menu.  Thoughts on how best to do this?

Thanks!
0
Comment
Question by:mattturley
  • 4
  • 4
  • 4
  • +1
13 Comments
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 18022724
Start word, hit alt+f11. This opens the vbe window. Select module from the insert menu and paste the code below. Close the vbe window. Back in word, hit alt+f4 select AddIT and hit run. This adds the menu. Use RemoveIT to delete it in future.

Sub AddIT()
With Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=5)
.Caption = "Change Cas&e...": .Style = msoButtonCaption
.TooltipText = "Change Case": .OnAction = "chngCase"
End With
End Sub

Sub chngCase()
Application.Dialogs(wdDialogFormatChangeCase).Show
End Sub

Sub RemoveIT()
Application.CommandBars("Text").Controls("Change Case...").Delete
End Sub
0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 18022834
This one is better...

Sub Test()
With Application.CommandBars("Text").Controls.Add(msoControlButton, 309, , 5, True)
    .Caption = "Change Cas&e..."
    .Style = msoButtonCaption
    .TooltipText = "Change Case"
End With
End Sub
0
 

Author Comment

by:mattturley
ID: 18022931
The second one didn't work.  And alt+f4 closes the open window??
0
 
LVL 24

Expert Comment

by:R_Rajesh
ID: 18022944
sorry. that should be alt+f8
0
 

Author Comment

by:mattturley
ID: 18022961
ah, see that you meant alt+f8
0
 
LVL 9

Assisted Solution

by:bernani
bernani earned 150 total points
ID: 18023662

Hope this can help.

The steps under are for Word2000 (options may be at others location in next versions)

1. You need to customize your toolbars (right-click on the menu at the very top of Word). In the list, choose "Customize".
2 In the tabs related to toolbars (the dialog you generally use to customise your toolbars), you need to find and check an item called "Context Menu" or sth like this [my version isn't in english] (in this way, this hidden Menu at runtime will be visible to let you add the required commands during cutomization time).
3.When you have check the checkbox of this toolbar, a toolbar with new menus show up (Context Menu). All the items present in this toolbar are the contextual menu displayed at runtime when you right-click an element in word.
4. In the Category Command (list of available menus, choose the item called Format). This list contains all the commands related to text formatting. Click the item called Change case... (the ico with 3 AAA) and drag and drop it on the
Context Menu->Text->Text. This item contains already the commands like cut, copy, paste ...

Close the dialog editor for customization.
Right click in a word doc.
The menu item "Change case ..." is now present in the correct popup menu.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 21

Assisted Solution

by:EricFletcher
EricFletcher earned 150 total points
ID: 18025486
Note that you can also use Shift-F3 to change the case without needing a macro at all. This keyboard shortcut cycles through lowercase, uppercase , and title case -- and affects whatever text is selected. If no text is selected (i.e. the cursor is within or in front of a word), it changes just the word.
0
 
LVL 9

Expert Comment

by:bernani
ID: 18027085

Hi,

I agree with EricFletcher as well as for the shortcut than with the assert that there is no need of a macro at all.

But, as the question asked is how to add change case to RIGHT CLICK.  Using shortcuts is keyboard related and not mouse related ;).

All the MOUSE right-click popup menus can be customized in word as explained in my previous post.
0
 

Author Comment

by:mattturley
ID: 18028685
OK, this is becoming a dialouge with lots of good suggestions.  I will split points to all that work, but hope to get more information on the post by bernani.  I am using Office 2003.  I customizing to unhide the Context menu, but do not see it in the list.  ANyone have thoughts?
0
 
LVL 9

Expert Comment

by:bernani
ID: 18029239
Hi,

Open a nex doc and the VBA Editor (Alt + F11)

Copy the following lines in a new module of your current open doc (Insert->New module). Don't change the default name (Module1), it's not important here.

Paste this (From Sub to End Sub):

Sub TestoContext()
'On error resume next
' Add an item called 'All uppercase'  in the commandBars "Text"
' Macro enregistrée le 28/11/2006
CommandBars("Text").Controls.Add Type:=msoControlButton, ID:=306, Before:=1
MsgBox ("Item added to context menu. First item with the name : All uppercase")
End Sub

Quit the VBA Editor (again Alt+F11)

Hit Alt + F8 to display the macro dialog box and execute the macro called Testocontext

If you see the message "Item added to context menu. First item with the name : All uppercase", it means that a new item has been added to your context menu. Right click in the document to see if the first item of your popup menu is well as expected "All uppercase" (or sth like this).

Note: if it succeed, don't call again the macro, or a second item will be added with the same name and functionality.

If running the macro reports an error, it could be that the model for command bars be slightly different in Word2003 or named differently.
I wrote these lines for Word 2000.

If it succeed, try to find somewhere in the commandbars list the one called "Text". (in French the name of the toolbar is "Menu contextuel" sth like "Context menu").
 
It it fails, it could be named different under Word 2003: maybe you can find that in the VBA help if installed on your sysytem..

But don't forget that when you've closed the customization dialog box with all available command bars, the one relative to context menus won't be visible anymore. Each item is only displayed when you right-click (popup menu different for each control).

0
 
LVL 9

Expert Comment

by:bernani
ID: 18029310

Hi,

If I look at the code written by R_Rajesh, it seems that the commands bars for the popup menu is still "Text". I presume he was writing the code with Word 2003.

If this is the case, the code I give you above must compîle.

If so, maybe he could be able to tell you what is the english name of the command bar present in the customization dialog box and relative to context menus.

 
0
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 200 total points
ID: 18030030
I believe this is what bernani is trying to tell you

Goto Tools - customize - Toolbars. Scroll down to Shortcut Menus and select it. The short cut menu floating toolbar should be visible now. Click on text and scroll to the bottom. Again select text form the list. The context menu should be visible now. From the Customize dialog, select the commands tab. From the Categories, select format. From the commands listbox on the right, select change case (there are two. select the one towards the end) and drag it across to the context menu. Click close on the customize dialog.

example:
http://msdn2.microsoft.com/en-us/library/aa155460(office.10).aspx
0
 

Author Comment

by:mattturley
ID: 18031019
A lot of great advice making it hard to split points on this one.  Thanks for everyone's input.  I LOVE this site.  It is the only website I pay for on a regular basis.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now