longwolf
Jan 11th, 2006, 02:37 PM
Hi,
I pretty good with VB6, but haven't worked with VBA.
Here's what I want to do,
I have a list of words that have matching replacement words.
If the user selects and right clicks a word in his WOrd Doc, I want to search my list.
If the selected word is in the list I want to temp add a new option to the right click menu, the option would have a sub menu of the matching words from the list.
Example:
Cut
Copy
Paste
--------------
Optional Words
Repalcement1
Repalcement2
Repalcement3
I've been going through the help files and cobbled this together, but it's not quite it.
I supose I could add the replacment words to the combo, but I wouldn't know how to add them or what sub to add in order to react to a combobox click.
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowBeforeRightClick _
(ByVal Sel As Selection, _
Cancel As Boolean)
Set myBar = CommandBars _
.Add(Name:="Custom", Position:=msoBarPopup, Temporary:=True)
With myBar
.Controls.Add Type:=msoControlButton, ID:=3
.Controls.Add Type:=msoControlComboBox
End With
myBar.ShowPopup
End Sub
I pretty good with VB6, but haven't worked with VBA.
Here's what I want to do,
I have a list of words that have matching replacement words.
If the user selects and right clicks a word in his WOrd Doc, I want to search my list.
If the selected word is in the list I want to temp add a new option to the right click menu, the option would have a sub menu of the matching words from the list.
Example:
Cut
Copy
Paste
--------------
Optional Words
Repalcement1
Repalcement2
Repalcement3
I've been going through the help files and cobbled this together, but it's not quite it.
I supose I could add the replacment words to the combo, but I wouldn't know how to add them or what sub to add in order to react to a combobox click.
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowBeforeRightClick _
(ByVal Sel As Selection, _
Cancel As Boolean)
Set myBar = CommandBars _
.Add(Name:="Custom", Position:=msoBarPopup, Temporary:=True)
With myBar
.Controls.Add Type:=msoControlButton, ID:=3
.Controls.Add Type:=msoControlComboBox
End With
myBar.ShowPopup
End Sub