PDA

View Full Version : What is your answer about this Question!



Esmatullah
12-21-2012, 06:17 AM
Hi Dear Friends!
I need a Macro do disable All Ribbons and menu. but we can edit the excel file like writing or other except using Ribbons and menu. thanks.

GTO
12-22-2012, 06:17 AM
...disregard.

Simon Lloyd
12-22-2012, 08:03 AM
Hi Dear Friends!
I need a Macro do disable All Ribbons and menu. but we can edit the excel file like writing or other except using Ribbons and menu. thanks.You cannot disable everything!

Paul_Hossler
12-23-2012, 04:16 PM
You can't do in in VBA (probably -- I can't anyway), but in the CustomUI it's easy



<!-- This is example : Excel 2007 Dictator(1).xlsm -->
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
 
<!-- **************************************************************************-->
<!-- ****Disable 'Exit Excel' and 'Excel Options' on the Office Button menu****-->
<!-- **************************************************************************-->
<commands>
<command idMso="ApplicationOptionsDialog"enabled="false"/>
<command idMso="FileExit"enabled="false"/>
</commands>
 
 
<!-- *******************************************************************-->
<!-- *****Set startFromScratch to true to hide the Ribbon and QAT*******-->
<!-- ********Hide New, Open and Save on the Office Button menu**********-->
<!-- **************Hide Contextual tabs on the Ribbon*******************-->
<!-- *******************************************************************-->
 
<!-- Set startFromScratch to true to hide the Ribbon and QAT-->
<ribbon startFromScratch="true">
<!-- startFromScratch="true" hides all of the Ribbon tabs and it hide the QAT. -->
<!-- It also hides most of the commands on the Office Button menu, but for -->
<!-- some reason, it does not hide the 'New', 'Open' and 'Save' commands. -->
<!-- Also it not hides the Contextual tabs on the ribbon, for example the -->
<!-- Format tab that you see when you select a picture on your worksheet. -->
<!-- So if you want to hide them you must use the RibbonX below: -->
<contextualTabs>
<tabSet idMso="TabSetSmartArtTools"visible="false" />
<tabSet idMso="TabSetChartTools"visible="false" />
<tabSet idMso="TabSetDrawingTools"visible="false" />
<tabSet idMso="TabSetPictureTools"visible="false" />
<tabSet idMso="TabSetPivotTableTools"visible="false" />
<tabSet idMso="TabSetHeaderAndFooterTools"visible="false" />
<tabSet idMso="TabSetTableToolsExcel"visible="false" />
<tabSet idMso="TabSetPivotChartTools"visible="false" />
<tabSet idMso="TabSetInkTools"visible="false" />
</contextualTabs>
 
<!-- You can add xml here to create your own custom tab on the ribbon-->
 
</ribbon>
</customUI>


The XML is from one of the Samples

Esmatullah
01-02-2013, 12:22 AM
But this is not valid VBA. When i type this Vba it Goes All red

Simon Lloyd
01-02-2013, 12:55 AM
The above is an xml that you can import in to excel, as Paul said you can't do it in VBA.

rcharters
01-02-2013, 02:08 PM
You may not be able to disable the menu and ribbon. But you can hide them.


Sub HideRibbon()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub

Kenneth Hobs
01-02-2013, 02:42 PM
For future posts, please make your subject line more meaningful.

See if this helps using the CustomUI. http://www.rondebruin.nl/ribbonx20072010.htm

Esmatullah
01-03-2013, 03:10 AM
But where i Can the XML code and how to Import it to Excel.

Esmatullah
01-03-2013, 03:36 AM
Dear Friend!
your XML Code is not Working. It says Invalid xml Code

Kenneth Hobs
01-03-2013, 07:47 AM
I gather by "it" you mean the Validate button from the Custom UI Editor.

Posting code here is not always perfect. XML code is NOT VBA code so let's see if Code tags work better. What the editor's Validate button is telling you is that you need a space character between options. That is how it delimits the command options.

I tested Paul's code in my x:\xml\CustomUI.xlsm file. I also changed the schema line for Excel 2010.


<!-- This Is example : CustomUI.xlsm -->
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">

<!-- **************************************************************************-->
<!-- ****Disable 'Exit Excel' and 'Excel Options' on the Office Button menu****-->
<!-- **************************************************************************-->
<commands>
<command idMso="ApplicationOptionsDialog" enabled="false"/>
<command idMso="FileExit" enabled="false"/>
</commands>


<!-- *******************************************************************-->
<!-- *****Set startFromScratch To True To hide the Ribbon And QAT*******-->
<!-- ********Hide New, Open And Save on the Office Button menu**********-->
<!-- **************Hide Contextual tabs on the Ribbon*******************-->
<!-- *******************************************************************-->

<!-- Set startFromScratch To True To hide the Ribbon And QAT-->
<ribbon startFromScratch="true">
<!-- startFromScratch="true" hides all of the Ribbon tabs And it hide the QAT. -->
<!-- It also hides most of the commands on the Office Button menu, but For -->
<!-- some reason, it does Not hide the 'New', 'Open' and 'Save' commands. -->
<!-- Also it Not hides the Contextual tabs on the ribbon, For example the -->
<!-- Format tab that you see when you select a picture on your worksheet. -->
<!-- So If you want To hide them you must use the RibbonX below: -->
<contextualTabs>
<tabSet idMso="TabSetSmartArtTools" visible="false" />
<tabSet idMso="TabSetChartTools" visible="false" />
<tabSet idMso="TabSetDrawingTools" visible="false" />
<tabSet idMso="TabSetPictureTools" visible="false" />
<tabSet idMso="TabSetPivotTableTools" visible="false" />
<tabSet idMso="TabSetHeaderAndFooterTools" visible="false" />
<tabSet idMso="TabSetTableToolsExcel" visible="false" />
<tabSet idMso="TabSetPivotChartTools" visible="false" />
<tabSet idMso="TabSetInkTools" visible="false" />
</contextualTabs>

<!-- You can add xml here To create your own custom tab on the ribbon-->

</ribbon>
</customUI>

Esmatullah
01-03-2013, 09:38 AM
Thanks. I have Got it.

Paul_Hossler
01-03-2013, 12:57 PM
Another thing to do would be to use the CustomUI editor on the attachment to my Post#4 and pull the XML out

You can copy/paste it into your own workbook's CustomUI section

Paul