PDA

View Full Version : Title and ribbon bar



Ary Casado
07-29-2011, 04:26 PM
:banghead: I need load Excel/2007 window without title and ribbon bars?? In VBA please!!!

eherron
10-27-2011, 06:48 AM
The code is below, but the problem with this is that it also removes the Office Button. Does anyone know how to keep the Office Button?
Private Sub Workbook_Activate()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
End Sub
Private Sub Workbook_Deactivate()
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",True)"
End Sub

frank_m
10-28-2011, 01:00 AM
Edit: sorry, I just noticed that you need to get rid of the title bar also, which my suggestions do not do
Perhaps the discussion about full screen mode at this link might help: http://www.mrexcel.com/forum/showthread.php?t=333929


To merely minimize the ribbon, rather than remove it, I use the code below in the sheets selection change event.
(admittedly this does not protect against a simple click by the user to maximize it)

If Val(Application.Version) >= 12 Then 'bipasses error for versions bellow 2007
If Not Application.CommandBars.Item("Ribbon").Height > 100 Then
' Ribbon is already Minimized - Do nothing
Else
' I found that using the If Not and Else structure works more consitantly
Application.SendKeys ("^{F1}") '~~Minimizes the Ribbon
End If
End If
-----------------------------------------------------
Howdy eherron,

To hide the ribbon and keep the office button, look here:
http://www.rondebruin.nl/hidevisible.htm
example #5 Hide-Display-Built-in Tabs.xlsm

I've tried it several months ago, it's pretty slick,
except to my dismay I did notice that some additional XML editing is needed to be able to see all of the Office buttons commands, ie: Print, open, close, save etc
-----------------------------------------------------
The edits are made to the file named customUI.xml within your Excel 2007 or 2010 .xlsm workbook.(which is not particularly for the novice)
-->in many case's you can very easiliy modify the buttons and sheets in the sample workbook to suit your needs, with no need to change any XML

If you need to modify the XML yourself, you will need to access a file named customUI.xml - It's actualy a file within the excel file itself.
-- One way to get to it, is to change the workbooks extension (ie: .xlsm to .zip - While a little tricky and/or risky to the novice, this can be done using a zip program and notepad.
* Though, most experts recommend that instead you use The Custom UI Editor.
A good starting point for learning more about all that can be found here:
http://www.rondebruin.nl/ribbon.htm

eherron
10-28-2011, 06:18 AM
Hi Frank,
I found it yesterday and editied it to display the "FileOpen", "FileSaveAs" and "FileClose" in the "Office Button" and it works great. I was actually answerring Ary's post, so I hope Ary see's this. Also, for any additional Icons that are needed to be displayed in the "Office Button", just add another "button idMso" line in the code below with "File" befor the Icon's name and have it equal "True" to display. Any can be turned off by changing the line to equal "False". I added 2 spaces in the 3rd line of the code because the site is not allowing the link - remove when pasting code.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="RibbonOnLoad" 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="true"/>
</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: -->
<officeMenu>
<button idMso="FileNew" visible="false"/>
<button idMso="FileOpen" visible="true"/>
<button idMso="FileSaveAs" visible="true"/>
<button idMso="FileClose" visible="true"/>
<button idMso="FileSave" visible="false" />
</officeMenu>
<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>
 
<!-- Create a custom tab for every original tab on the Ribbon with the same name. -->
<!-- Add every origenal group to this custom tabs to duplicate the original tabs. -->
<!-- We can now use getVisible to hide/display the tabs with a VBA macro. -->
<!-- Note: Normal getVisible is not working for specific built-in tabs/groups/controls. -->
<tabs>
<tab id="MyCustomHomeTab" label="Home" insertAfterMso="TabHome" getVisible="GetVisible" tag="ribhome">
<group idMso="GroupClipboard" />
<group idMso="GroupFont" />
<group idMso="GroupAlignmentExcel" />
<group idMso="GroupNumber" />
<group idMso="GroupStyles" />
<group idMso="GroupCells" />
<group idMso="GroupEditingExcel" />
</tab>
<tab id="MyCustomInsertTab" label="Insert" insertAfterMso="TabInsert" getVisible="GetVisible" tag="ribinsert">
<group idMso="GroupInsertTablesExcel" />
<group idMso="GroupInsertIllustrations" />
<group idMso="GroupInsertChartsExcel" />
<group idMso="GroupInsertLinks" />
<group idMso="GroupInsertText" />
</tab>
<tab id="MyCustomPageLayoutTab" label="Page Layout" insertAfterMso="TabPageLayoutExcel" getVisible="GetVisible" tag="ribpagelayout">
<group idMso="GroupThemesExcel" />
<group idMso="GroupPageSetup" />
<group idMso="GroupPageLayoutScaleToFit" />
<group idMso="GroupPageLayoutSheetOptions" />
<group idMso="GroupArrange" />
</tab>
<tab id="MyCustomFormulasTab" label="Formulas" insertAfterMso="TabFormulas" getVisible="GetVisible" tag="ribformulas">
<group idMso="GroupFunctionLibrary" />
<group idMso="GroupNamedCells" />
<group idMso="GroupFormulaAuditing" />
<group idMso="GroupCalculation" />
</tab>
<tab id="MyCustomDataTab" label="Data" insertAfterMso="TabData" getVisible="GetVisible" tag="ribdata">
<group idMso="GroupGetExternalData" />
<group idMso="GroupConnections" />
<group idMso="GroupSortFilter" />
<group idMso="GroupDataTools" />
<group idMso="GroupOutline" />
</tab>
<tab id="MyCustomReviewTab" label="Review" insertAfterMso="TabReview" getVisible="GetVisible" tag="ribreview">
<group idMso="GroupProofing" />
<group idMso="GroupComments" />
<group idMso="GroupChangesExcel" />
</tab>
<tab id="MyCustomViewTab" label="View" insertAfterMso="TabView" getVisible="GetVisible" tag="ribview">
<group idMso="GroupWorkbookViews" />
<group idMso="GroupViewShowHide" />
<group idMso="GroupZoom" />
<group idMso="GroupWindow" />
<group idMso="GroupMacros" />
</tab>
<tab id="MyCustomDeveloperTab" label="Developer" insertAfterMso="TabDeveloper" getVisible="GetVisible" tag="ribdeveloper">
<group idMso="GroupCode" />
<group idMso="GroupControls" />
<group idMso="GroupXml" />
<group idMso="GroupModify" />
</tab>

</tabs>
</ribbon>
</customUI>