Solved

Add Change Case to Right Click

Posted on 2006-11-27
13
283 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Assisted Solution

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

688 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