?
Solved

Add Change Case to Right Click

Posted on 2006-11-27
13
Medium Priority
?
289 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 600 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
 
LVL 21

Assisted Solution

by:Eric Fletcher
Eric Fletcher earned 600 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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 …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
Suggested Courses

770 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