|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
vba Word: How to add selected text into right click menu, or add right clicked word in menu
I want to add Selected text into right click menu as a .caption
here is my code Code:
PublicSub CreateMacro() Application.CommandBars("Text").Reset Dim MenuButton As CommandBarButton With CommandBars("Text") Set MenuButton =.Controls.Add(msoControlButton) With MenuButton .Caption = Selection.Text .Style = msoButtonCaption .OnAction ="Test_Macro" EndWith EndWith EndSub PublicSub Test_Macro() MsgBox "I work" ResetRightClick CreateMacro EndSub Sub ResetRightClick() Application.CommandBars("Text").Reset EndSub on first attempt right click menu is displayed but empty caption, and on next times it show older caption (not current selection) until the menu item is clicked or how to add Right clicked word into right clicked menu |
#2
|
||||
|
||||
Cross-posted at: http://www.vbaexpress.com/forum/show...clicked-word-i
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
|
Tags |
vba, word 2003 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Microsoft Word: How to Add Thesaurus Option in right click menu | mithun | Word | 2 | 12-14-2016 10:38 AM |
Modify right-click context menu to only allow pasting text | derajlance | Word VBA | 0 | 05-24-2016 02:25 PM |
Microsoft Word, right click in document-how make text larger in menu | pcumming | Word | 1 | 02-07-2015 07:47 PM |
Adding Macro menu to the right click menu (Word 2007) | masam123 | Word | 0 | 10-14-2011 04:05 AM |
How to get the Name of the selected menu | anil3b2 | Word | 0 | 07-26-2010 02:44 AM |