Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / March 2007

Tip: Looking for answers? Try searching our database.

Hiding menu items in Office 2007

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TOPry - 23 Mar 2007 22:47 GMT
I need to hide/disable the OPEN/NEW/SAVE AS options in Word and Excel 2007.
(ideally hide).

In 2003, I could create a custom template that had those buttons/menu
selections removed and set CommandBars.DisableCustomize=True to accomplish
this.

I have yet to figure out how to do the same thing in 2007. I have tried
creating a customUI template and setting the startFromScratch attribute of
the ribbon property to "true", which removes all of the ribbons (which I do
not want), but even that option leaves OPEN AND NEW on the Office Button.

I want all of the ribbons left on, just need to disable/remove those 3
features as the users must open/save their documents through a custom UI.
I have tried over-riding the application_DocumentBeforeSave and _NewDocument
events, but I prefer to remove those selections from the menu, if possible.

Any help appreciated.
Norm Estabrook - 27 Mar 2007 23:19 GMT
Hi ToPry,

Try the following:

1. Add the <officeMenu> element to the Ribbon XML file.

2. Add buttons to the office menu.

3. Set the idMso attribute of each button to control ID of each item you
want to hide.  You can find a complete list of built-in control ID's at
http://www.microsoft.com/downloads/details.aspx?familyid=4329d9e9-4d11-46a5-898d
-23e4f331e9ae&displaylang=en
.

4. Set the visible attribute of the button to false. In the following
example, I hide the "Open" item in the Office menu:

<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load"
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon>
       <officeMenu>
           <button idMso="FileOpen" showImage="false" visible="false"/>
       </officeMenu>
   </ribbon>
</customUI>

Please let me know if this works out.

Thanks

Norm E.

> I need to hide/disable the OPEN/NEW/SAVE AS options in Word and Excel 2007.
> (ideally hide).
[quoted text clipped - 14 lines]
>
> Any help appreciated.
TOPry - 28 Mar 2007 15:05 GMT
Norm - thank you very much for the reply.
This method works fine for FileNew, FileOpen, but unfortunately did not have
any effect on FileSaveAs (or any of those identified as 'splitbutton'). I
also tried FileSaveAsMenu, and each of the FileSaveAs types, with no
success. I have reviewed the cutomization articles on MSDN and the examples
to add tabs, groups and controls. But did not find any reference to this
relatively simply (I would think) task.

I imagine my XML descriptors are incorrect. I did try to identify them as
group and splitbutton (as well as button), but those descriptors were
invalid and prevented the XML from being processed.

If you could help point me in the right direction I would appreciate it.

Regards,

Tim

> Hi ToPry,
>
[quoted text clipped - 51 lines]
>>
>> Any help appreciated.
Norm Estabrook - 28 Mar 2007 21:00 GMT
Hi ToPry,
Strange. "FileSaveAs" worked well for me. The following XML cleared my
entire office button. Can you try this?

<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load"
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon>
       <officeMenu>
           <button idMso="FileNew" showImage="false" visible="false"/>
           <button idMso="FileOpen" showImage="false" visible="false"/>
           <button idMso="FileSave" showImage="false" visible="false"/>
           <button idMso="FileSaveAs" showImage="false" visible="false"/>
           <menu idMso="FileSaveAsMenu" showImage="false" visible="false"/>
           <button idMso="FilePrint" showImage="false" visible="false"/>
           <menu idMso="FilePrintMenu" showImage="false" visible="false"/>
           <button idMso="FileProperties" showImage="false" visible="false"/>
           <button idMso="FileClose" showImage="false" visible="false"/>
           <menu idMso="MenuPublish" showImage="false" visible="false"/>
           <menu idMso="FileSendMenu" showImage="false" visible="false"/>
           <menu idMso="FilePrepareMenu" showImage="false" visible="false"/>
       </officeMenu>
   </ribbon>
</customUI>

Please let me know if this helps.

Thanks!

Norm E.

> Norm - thank you very much for the reply.
> This method works fine for FileNew, FileOpen, but unfortunately did not have
[quoted text clipped - 69 lines]
> >>
> >> Any help appreciated.
TOPry - 29 Mar 2007 14:15 GMT
The 'menu' descriptor was one I did not try - using that worked fine. The MS
doc shows the control type as 'splitbutton', which I had tried - just had
not considered something as simple as 'menu'. Thank you very much!

One last question, if I may - I don't suppose you found this documented
somewhere? I have the VSTO book by Carter/Lippert and have read several MSDN
articles on customizing the UI, and while they do a good job of describing
how to add functionality to Office, my primary focus is 'controlling' the
interface.

Thanks again,

Tim

> Hi ToPry,
> Strange. "FileSaveAs" worked well for me. The following XML cleared my
[quoted text clipped - 111 lines]
>> >>
>> >> Any help appreciated.
Norm Estabrook - 29 Mar 2007 22:58 GMT
Here are some Ribbon topics in the Visual Studio Tools for Office help
documentation.

"Ribbon Extensibility Overview" at
http://msdn2.microsoft.com/en-us/library/aa942866(VS.80).aspx

"How to: Customize the Ribbon" at
http://msdn2.microsoft.com/en-us/library/aa942954(VS.80).aspx.

"Walkthrough: Automating an Application from Controls on the Ribbon" at
http://msdn2.microsoft.com/en-us/library/aa942955(VS.80).aspx.

You can find several other Ribbon topics outside of the Visual Studio Tools
for Office help collection. View those topics here ->
http://msdn2.microsoft.com/en-us/library/bb187362.aspx.

For VSTO 2005 SE, the development experience with VSTO or without VSTO is
very similar. Therefore, you can use these topics to get tips on using the
Ribbon XML elements, attributes, etc as well as using callbacks to respond to
user actions etc.

If you need further help, consider posting your question in the VSTO forum.  
You can find the forum at
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=16&SiteID=1.  
Forum questions are monitored by Microsoft developers and managers who
actually created the Ribbon feature. Who better to ask?

Hope that helps!

Norm E.

> The 'menu' descriptor was one I did not try - using that worked fine. The MS
> doc shows the control type as 'splitbutton', which I had tried - just had
[quoted text clipped - 125 lines]
> >> >>
> >> >> Any help appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.