celobateira
Member
- Joined
- Feb 19, 2007
- Messages
- 18
- Programming Experience
- Beginner
Hi,
I'm using Visual Basic 2005 to make an add-in for both Word and Excel (Office XP).
I created 1 CommandBar Button and 1 MenuItem in File Menu.
In excel both controls work perfectly, but in Word The MenuItem doesn't erase and each time I open Word, it keeps adding a new Menu Item... not to mention that the Menuitem doesn't fire any event
In other words... if I open the word 10 times, I go to the File Menu and I have 10 "MyMenuItems"
Why the add-in deletes the Menuitem for excel and not for Word?
What should I do to solve this problem?
I have this code on OnStartupComplete:
And this code on OnBeginShutDown
Any help Apreciated...thanx
[EDIT] Can't delete the toolbar button on word too..
I'm using Visual Basic 2005 to make an add-in for both Word and Excel (Office XP).
I created 1 CommandBar Button and 1 MenuItem in File Menu.
In excel both controls work perfectly, but in Word The MenuItem doesn't erase and each time I open Word, it keeps adding a new Menu Item... not to mention that the Menuitem doesn't fire any event
In other words... if I open the word 10 times, I go to the File Menu and I have 10 "MyMenuItems"
Why the add-in deletes the Menuitem for excel and not for Word?
What should I do to solve this problem?
I have this code on OnStartupComplete:
VB.NET:
MyMenuBar = applicationObject.CommandBars.Item("File")
MyMenuItem = MyMenuBar.Controls.Add(MsoControlType.msoControlButton, 1, "", 6, True)
With MyMenuItem
.Caption = "Save MyMenuItem"
.Enabled = True
.Visible = True
.OnAction = "!<MyCOMAddin.Connect>"
.Style = MsoButtonStyle.msoButtonIconAndCaption
End With
VB.NET:
OnErrorResumeNext
MyMenuItem.Delete(False)
MyMenuItem = Nothing
[EDIT] Can't delete the toolbar button on word too..
Last edited: