Word: CommandBars.Item("Text")

  • Thread starter Thread starter SunSet
  • Start date Start date
S

SunSet

Hello togehther,
i want to add a new Popup to the Contextmenue in Word (Right click on
the textbody) which all is included in an AddIn. To add a new button
works fine with these piece of code:

oCommandBars = applicationObject.CommandBars
KontextMenu =
oCommandBars("Text").Controls.Add(MsoControlType.msoControlPopup, , , ,
True)
KontextMenu.BeginGroup = True
With KontextMenu
.Tag = "Textartwählen"
.Caption = "Textartwählen"
End With

KontextMenu1 =
KontextMenu.Controls.Add(MsoControlType.msoControlButton, , , , True)
With KontextMenu1
.Caption = "Textart1"
.FaceId = 63
.Tag = "Textart1"
.OnAction = "!<CataloX.Connect>"
.Visible = True
End With

But...
with theses piece of code i try to reset the commandbar. And that
didn't work.

oCommandBars = applicationObject.CommandBars
oCommandBars.Item("Text").Reset()

Everytime i open the Document a new menu ("Textartwählen") with a
button ("Textart1") is added to the contextmenue (CommandBars("Text")).


Someone there who had an idea what i do wrong ?

Sincerly,

Bernd
 
Back
Top