Hide MenuBar/ToolBar in Excel 2007

C

chovatia.jaydeep

Hi,

I want to hide MenuBar/ToolBar in Excel 2007 programmatically. I am
using Excel COM component TExcelApplication in Borland C++ 6.0.

Please let me know the code/tricks to do this.

Thank You,
Jaydeep Chovatia
 
C

chovatia.jaydeep

Jaydeep

You will need to write XML (RibbonX) to the file in you add-in.

You can check here for ideas

http://www.nickhodge.co.uk/2007files/customiseribbon.htm

and here

http://msdn2.microsoft.com/en-us/library/aa338202.aspx

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
web:www.nickhodge.co.uk

Hi Nick,

Thanks for the quick response.

I got success in hiding the menu items using the solution give at:
http://msdn2.microsoft.com/en-us/library/aa338202.aspx

Following code i have written in xml file to hide File menu items
-------------------------------------------------------------------------------------------------------------------
Start Code
-------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load"
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<button idMso="FileOpen" showImage="false" visible="false"/<button idMso="FileSave" showImage="false" visible="false"/<button idMso="FileSaveAs" showImage="false"
visible="false"/>
<button idMso="FileSaveAsMenu" showImage="false"
visible="false"/>
<button idMso="FilePrint" showImage="false"
visible="false"/>
<button idMso="FilePrintMenu" showImage="false"
visible="false"/>
<button idMso="FileProperties" showImage="false"
visible="false"/>
<button idMso="FileClose" showImage="false"
visible="false"/>
<button idMso="MenuPublish" showImage="false"
visible="false"/>
<button idMso="FileSendMenu" showImage="false"
visible="false"/>
<button idMso="FilePrepareMenu" showImage="false"
visible="false"/>
</officeMenu>
</ribbon>
</customUI>

-------------------------------------------------------------------------------------------------------------------
End Code
-------------------------------------------------------------------------------------------------------------------

Above code successfully hides all the menu items for main menu "File",
but i also want to hide all the main menus including "View", "Insert",
"Formula",.....

Can you please suggest me code which will hide main menus like "View",
"Formula","Home",... as well as their sub menus like Home->Copy, Home-
Paste,.....

Thank You,
Jaydeep Chovatia
 
J

Jim Rech

Use the startFromScratch attribute.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<officeMenu>

--
Jim
| On May 22, 3:12 am, "Nick Hodge"
| > Jaydeep
| >
| > You will need to write XML (RibbonX) to the file in you add-in.
| >
| > You can check here for ideas
| >
| > http://www.nickhodge.co.uk/2007files/customiseribbon.htm
| >
| > and here
| >
| > http://msdn2.microsoft.com/en-us/library/aa338202.aspx
| >
| > --
| > HTH
| > Nick Hodge
| > Microsoft MVP - Excel
| > Southampton, England
| > (e-mail address removed)
| > web:www.nickhodge.co.uk
| > blog (non-tech):www.nickhodge.co.uk/blog/<[email protected]>
wrote in message
| >
| > | >
| > > Hi,
| >
| > > I want tohideMenuBar/ToolBar in Excel 2007 programmatically. I am
| > > using Excel COM componentTExcelApplicationin Borland C++ 6.0.
| >
| > > Please let me know the code/tricks to do this.
| >
| > > Thank You,
| > > Jaydeep Chovatia
|
| Hi Nick,
|
| Thanks for the quick response.
|
| I got success in hiding the menu items using the solution give at:
| http://msdn2.microsoft.com/en-us/library/aa338202.aspx
|
| Following code i have written in xml file to hide File menu items
| -------------------------------------------------------------------------------------------------------------------
| Start Code
| -------------------------------------------------------------------------------------------------------------------
| <?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"/>
| <button idMso="FileSaveAsMenu" showImage="false"
| visible="false"/>
| <button idMso="FilePrint" showImage="false"
| visible="false"/>
| <button idMso="FilePrintMenu" showImage="false"
| visible="false"/>
| <button idMso="FileProperties" showImage="false"
| visible="false"/>
| <button idMso="FileClose" showImage="false"
| visible="false"/>
| <button idMso="MenuPublish" showImage="false"
| visible="false"/>
| <button idMso="FileSendMenu" showImage="false"
| visible="false"/>
| <button idMso="FilePrepareMenu" showImage="false"
| visible="false"/>
| </officeMenu>
| </ribbon>
| </customUI>
|
| -------------------------------------------------------------------------------------------------------------------
| End Code
| -------------------------------------------------------------------------------------------------------------------
|
| Above code successfully hides all the menu items for main menu "File",
| but i also want to hide all the main menus including "View", "Insert",
| "Formula",.....
|
| Can you please suggest me code which will hide main menus like "View",
| "Formula","Home",... as well as their sub menus like Home->Copy, Home-
| >Paste,.....
|
| Thank You,
| Jaydeep Chovatia
|
 
C

chovatia.jaydeep

Hi,

Thanks for your response.

Hiding menu/tools works fine for *.XLSX files.

How can we achieve same for .txt file?

1) Create abc.txt file with some data in TAB separated format.
2) Right click on abc.txt - Choose option open with - Select Microsoft
Office Excel
3) Opens abc.txt in Excel office, but here again it shows menu items.

My question is how can we hide menu/tools if we open excel using .txt
file.

Thank You,
Jaydeep
 
N

Nick Hodge

Jaydeep

I suspect you will need to hijack the shortcut 'Open with MS Office Excel
and change it's parameters to open a template that modifies the ribbon on
opening

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
web: www.nickhodge.co.uk
blog (non-tech): www.nickhodge.co.uk/blog/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top