Visual Studio Developer Center >
Visual Studio Forums
>
Visual Studio Tools for Office
>
Add/deleting builtin items off the &Toolbars menu (ID: 30045)
Add/deleting builtin items off the &Toolbars menu (ID: 30045)
- Hi, i'm trying to add and remove items off the &Toolbars menu in Word, Excel and Powerpoint (Office 2003) using VB.NET 2005. If someone could help me for one i can probably work out the others.
So in Powerpoint you have the View -> ToolBars menu, with a list of the builtin toolbars (Standard, Formatting, Drawing etc) and i'd like to add Reviewing (id:=142), Revisions(id:=1478) and Task Pane(id:=1423) via code. I can grab the &Toolbars submenu with:
However you cant seem to say delete the items on the Toolbar List. Going from another angle:dim objBar as CommandBar
dim objSubMenu as CommandBarControl
' mobjApplication is your office application object
objBar = mobjApplication.CommandBars("View" )
objSubMenu = objBar.FindControl(id:=30045) ' &Toolbars submenu
dim objBarReview as CommandBar
would for a custom commandbar make it show on the &Toolbars menu, but does not change the .Enabled property on the Reviewing commandbar? Just creating your own custom commandbar (mobjApplication.CommandBars.Add) seems to automatically and dynamically add to the &ToolBars list?
objBarReview = mobjApplication.CommandBars("Reviewing") ' ID= 142
with objBarReview
.position = MSOBarPosition.msoBarTop
.Enabled = True
End With
So what's up with the builtin commandbars? or am i just going about this wrong? Any help appreciated!
Windows 2000 Professional 5.0.2195
Visual Studio 2005 Pro 8.0.50727.42
.NET Framework 2.0.50727
Powerpoint 2003 11.8307.8221 SP3
EDIT: sorry for the formatting on the code snippets, just seems to go weird. I'm obviously not declaring variables incorrectly...- Moved byJeff ShanMSFTMonday, November 02, 2009 3:39 AMvsto question (From:Visual Basic General)
Answers
- Hi Zane
Since you're not using the VSTO technology, the VSTO forum isn't really the right place for your question. You'll find a description about what VSTO is, along with some links for non-VSTO, Office-related questions, in the VSTO forum's Please Read First message. In your case, I recommend asking in the PowerPoint newsgroup, where you'll find application specialists.
As to formatting of code snippets, when you post in a forum: At the far right of the "toolbar" there's an icon that opens a popup window. This is for adding code snippets; using it will result in better line breaks and formatting. (I don't always use it, either, but if I have more than a couple of lines I do.)
FWIW, there are some menus you cannot affect in the Office applications. Generally, those that the application generates dynamically (such as a list of toolbars or the MRU list) you cannot selectively manipulate. I'm guessing that's the case in the particular scenario you describe. What you could try doing (and I never have, so this is just a suggestion off the top of my head) would be to make the built-in, top-level menu point not visible, then create your own pop-up menu and populate the list of commandbarbuttons for that.
Cindy Meister, VSTO/Word MVP- Marked As Answer byBessie ZhaoMSFT, ModeratorFriday, November 06, 2009 10:28 AM
All Replies
Try VSTO (visual studio tools for office) forum http://social.msdn.microsoft.com/forums/en-US/vsto/threads/
kaymaf
If that what you want, take it. If not, ignored it and no complain- Ahh thanks. It appears a mod has already moved me.
Also i should add we're running Workshare/Filesite office integration, just in case that's throwing any spanners into the commandbars? - Hi Zane
Since you're not using the VSTO technology, the VSTO forum isn't really the right place for your question. You'll find a description about what VSTO is, along with some links for non-VSTO, Office-related questions, in the VSTO forum's Please Read First message. In your case, I recommend asking in the PowerPoint newsgroup, where you'll find application specialists.
As to formatting of code snippets, when you post in a forum: At the far right of the "toolbar" there's an icon that opens a popup window. This is for adding code snippets; using it will result in better line breaks and formatting. (I don't always use it, either, but if I have more than a couple of lines I do.)
FWIW, there are some menus you cannot affect in the Office applications. Generally, those that the application generates dynamically (such as a list of toolbars or the MRU list) you cannot selectively manipulate. I'm guessing that's the case in the particular scenario you describe. What you could try doing (and I never have, so this is just a suggestion off the top of my head) would be to make the built-in, top-level menu point not visible, then create your own pop-up menu and populate the list of commandbarbuttons for that.
Cindy Meister, VSTO/Word MVP- Marked As Answer byBessie ZhaoMSFT, ModeratorFriday, November 06, 2009 10:28 AM
Try VSTO (visual studio tools for office) forum
the VSTO forum isn't really the right place for your question.
Ha ha, bounced around like a leper no-one wants to know...
Cheers Cindy, i was coming around to creating my own pop-up menu, but being fundamentally lazy thought using the built-in toolbar would be less effort. I shall give that an attempt.
Try VSTO (visual studio tools for office) forum
the VSTO forum isn't really the right place for your question.
Ha ha, bounced around like a leper no-one wants to know...
Cheers Cindy, i was coming around to creating my own pop-up menu, but being fundamentally lazy thought using the built-in toolbar would be less effort. I shall give that an attempt.
But you noticed I didn't bounce you :-) Let me know how it goes.
Cindy Meister, VSTO/Word MVP


