Hide 2 buttons when 1 Button is selected

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
I have the following XML in a Custom Ribbon I have created


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" ******="RibbonControl******">
<ribbon>
<tabs>
<tab id="tBreakdowns" label="Breakdowns">
<group id="gCustGrp1" label="Breakdowns" >
<button id="bSummary" size="large" label="Summary" imageMso="BlogHomePage"
screentip = "Summary" onAction="CallSummary"
supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
<button id="bFloor" size="large" label="Floor" imageMso="AlignJustify"
screentip = "Floor" onAction="CallFloor"
supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
<button id="bDrawing" size="large" label="Drawing" imageMso="BlogCategories"
screentip = "Drawing" onAction="CallDrawing"
supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>
<button id="bZone" size="large" label="Zone" imageMso="AlignJustifyHigh"
screentip = "Zone" onAction="CallZone"
supertip = "Displays the Zone information on the Copy Ready Worksheet"/>
</group>
<group id="gCustGrp2" label="Import Data" tag="AdminGroup" >
<button id="bChooseImportFile" size="large" label="Choose Import File" imageMso="BlogPublish"
screentip = "Choose the file you need to import"
supertip = "Runs the Choose File macro" onAction="CallChooseFile"/>
<button id="bImportData" size="large" label="Import Data" imageMso="CollapseAll"
screentip = "Import Data" onAction="CallImportRawData"
supertip = "Runs the Import Data macro"/>
<button id="bHidAndSave" size="large" label="Hide Input Save As" imageMso="FileSave"
screentip = "Hide Input tab and Save As" onAction="CallImportRawData"
supertip = "Runs the Import Data macro"/>
</group>
<group id="AlternateBaseFilter" label="Base" >
<button id= "AlternateBase" label = "Alternate" size="large"
onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
supertip = "Switches Alternate field values between Alernate and Base" />
</group>
<group id="gInfo" label="Info" >
<button id= "bInfo" label = "Info" size="large"
onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
supertip = "Show information about this file." />
</group>
</tab>
<tab id="tBreakdowns2" label="Breakdowns2">
<group id="gCustGrp3" label="Breakdowns2" >
<button id="bSummary2" size="large" label="Summary" imageMso="BlogHomePage"
screentip = "Summary" onAction="CallSummary"
supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
<button id="bFloor2" size="large" label="Floor" imageMso="AlignJustify"
screentip = "Floor" onAction="CallFloor"
supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
<button id="bDrawing2" size="large" label="Drawing" imageMso="BlogCategories"
screentip = "Drawing" onAction="CallDrawing"
supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>
<button id="bZone2" size="large" label="Zone" imageMso="AlignJustifyHigh"
screentip = "Zone" onAction="CallZone"
supertip = "Displays the Zone information on the Copy Ready Worksheet"/>
</group>
<group id="AlternateBaseFilter2" label="Base" >
<button id= "AlternateBase2" label = "Alternate" size="large"
onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
supertip = "Switches Alternate field values between Alernate and Base" />
</group>
<group id="gInfo2" label="Info" >
<button id= "bInfo2" label = "Info" size="large"
onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
supertip = "Show information about this file." />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

When the HideInputSaveAs button is selected I want to hide the Choose Input File, Import File buttons or just show the Breakdowns2 Ribbon.

I have spent the last day and a half really learning a lot of great things on this but I have yet to find something that works.

I have even tried this:

Code:
Sub hide_ribbon()
    Application.ExecuteExcel4Macro "show.toolbar(""Breakdowns"", False)"
End Sub

It will not work.

Any help is always greatly appreciated!
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
'<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" ******="RibbonControl******">
' <ribbon>
' <tabs>
' <tab id="tBreakdowns" label="Breakdowns">
' <group id="gCustGrp1" label="Breakdowns" >
' <button id="bSummary" size="large" label="Summary" imageMso="BlogHomePage"
' screentip = "Summary" onAction="CallSummary"
' supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
' <button id="bFloor" size="large" label="Floor" imageMso="AlignJustify"
' screentip = "Floor" onAction="CallFloor"
' supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
' <button id="bDrawing" size="large" label="Drawing" imageMso="BlogCategories"
' screentip = "Drawing" onAction="CallDrawing"
' supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>
' <button id="bZone" size="large" label="Zone" imageMso="AlignJustifyHigh"
' screentip = "Zone" onAction="CallZone"
' supertip = "Displays the Zone information on the Copy Ready Worksheet"/>
' </group>
' <group id="gCustGrp2" label="Import Data" tag="AdminGroup" >
' <button id="bChooseImportFile" size="large" label="Choose Import File" imageMso="BlogPublish"
' screentip = "Choose the file you need to import"
' supertip = "Runs the Choose File macro" onAction="CallChooseFile"/>
' <button id="bImportData" size="large" label="Import Data" imageMso="CollapseAll"
' screentip = "Import Data" onAction="CallImportRawData"
' supertip = "Runs the Import Data macro"/>
' <button id="bHidAndSave" size="large" label="Hide Input Save As" imageMso="FileSave"
' screentip = "Hide Input tab and Save As" onAction="CallImportRawData"
' supertip = "Runs the Import Data macro"/>
' </group>
' <group id="AlternateBaseFilter" label="Base" >
' <button id= "AlternateBase" label = "Alternate" size="large"
' onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
' supertip = "Switches Alternate field values between Alernate and Base" />
' </group>
' <group id="gInfo" label="Info" >
' <button id= "bInfo" label = "Info" size="large"
' onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
' supertip = "Show information about this file." />
' </group>
' </tab>
' <tab id="tBreakdowns2" label="Breakdowns2">
' <group id="gCustGrp3" label="Breakdowns2" >
' <button id="bSummary2" size="large" label="Summary" imageMso="BlogHomePage"
' screentip = "Summary" onAction="CallSummary"
' supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
' <button id="bFloor2" size="large" label="Floor" imageMso="AlignJustify"
' screentip = "Floor" onAction="CallFloor"
' supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
' <button id="bDrawing2" size="large" label="Drawing" imageMso="BlogCategories"
' screentip = "Drawing" onAction="CallDrawing"
' supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>
' <button id="bZone2" size="large" label="Zone" imageMso="AlignJustifyHigh"
' screentip = "Zone" onAction="CallZone"
' supertip = "Displays the Zone information on the Copy Ready Worksheet"/>
' </group>
' <group id="AlternateBaseFilter2" label="Base" >
' <button id= "AlternateBase2" label = "Alternate" size="large"
' onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
' supertip = "Switches Alternate field values between Alernate and Base" />
' </group>
' <group id="gInfo2" label="Info" >
' <button id= "bInfo2" label = "Info" size="large"
' onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
' supertip = "Show information about this file." />
' </group>
' </tab>
' </tabs>
' </ribbon>
'</customUI>
 
Upvote 0
Here is the XML

Code:
|<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" ******="RibbonControl******">
|  <ribbon>
|     <tabs>
|      <tab id="tBreakdowns" label="Breakdowns">
|         <group id="gCustGrp1" label="Breakdowns" >
|             <button id="bSummary" size="large" label="Summary" imageMso="BlogHomePage"
|                     screentip = "Summary" onAction="CallSummary" 
| 			  supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
| 		<button id="bFloor" size="large" label="Floor" imageMso="AlignJustify"
|                     screentip = "Floor" onAction="CallFloor" 
| 			  supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
|  		<button id="bDrawing" size="large" label="Drawing" imageMso="BlogCategories"
| 			  screentip = "Drawing" onAction="CallDrawing"
| 			  supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>          
| 		<button id="bZone" size="large" label="Zone" imageMso="AlignJustifyHigh"
|                     screentip = "Zone" onAction="CallZone"
| 			  supertip = "Displays the Zone information on the Copy Ready Worksheet"/>                    
|         </group>
| 	  <group id="gCustGrp2" label="Import Data" tag="AdminGroup" >
|             <button id="bChooseImportFile" size="large" label="Choose Import File" imageMso="BlogPublish"
|                     screentip = "Choose the file you need to import"
| 			  supertip = "Runs the Choose File macro" onAction="CallChooseFile"/>    
| 		<button id="bImportData" size="large" label="Import Data" imageMso="CollapseAll"
| 			  screentip = "Import Data" onAction="CallImportRawData" 
| 		  	  supertip = "Runs the Import Data macro"/> 
| 		<button id="bHidAndSave" size="large" label="Hide Input Save As" imageMso="FileSave"
| 			  screentip = "Hide Input tab and Save As" onAction="CallImportRawData" 
| 		  	  supertip = "Runs the Import Data macro"/> 
|  	  </group>	
| 	  <group id="AlternateBaseFilter" label="Base" >
|    		<button id= "AlternateBase" label = "Alternate" size="large"  							  
| 			  onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
| 			  supertip = "Switches Alternate field values between Alernate and Base" /> 
|   	  </group>
| 	  <group id="gInfo" label="Info" >
|    		<button id= "bInfo" label = "Info" size="large"  							  
| 			  onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
| 			  supertip = "Show information about this file." /> 
|   	  </group>
|       </tab>
|       <tab id="tBreakdowns2" label="Breakdowns2">
|         <group id="gCustGrp3" label="Breakdowns2" >
|             <button id="bSummary2" size="large" label="Summary" imageMso="BlogHomePage"
|                     screentip = "Summary" onAction="CallSummary" 
| 			  supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
| 		<button id="bFloor2" size="large" label="Floor" imageMso="AlignJustify"
|                     screentip = "Floor" onAction="CallFloor" 
| 			  supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
|  		<button id="bDrawing2" size="large" label="Drawing" imageMso="BlogCategories"
| 			  screentip = "Drawing" onAction="CallDrawing"
| 			  supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>          
| 		<button id="bZone2" size="large" label="Zone" imageMso="AlignJustifyHigh"
|                     screentip = "Zone" onAction="CallZone"
| 			  supertip = "Displays the Zone information on the Copy Ready Worksheet"/>                    
|         </group>
| 	  <group id="AlternateBaseFilter2" label="Base" >
|    		<button id= "AlternateBase2" label = "Alternate" size="large"  							  
| 			  onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
| 			  supertip = "Switches Alternate field values between Alernate and Base" /> 
|   	  </group>
| 	  <group id="gInfo2" label="Info" >
|    		<button id= "bInfo2" label = "Info" size="large"  							  
| 			  onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
| 			  supertip = "Show information about this file." /> 
|   	  </group>
|       </tab>
|     </tabs>
|   </ribbon>
| </customUI>

Hopefully this works I saw this in another example here on MrExcel that used the | symbol.
 
Upvote 0
Code:
|?xml version="1.0" encoding="UTF-8" standalone="yes"?>customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" ******="RibbonControl******">
  |ribbon>
    |tabs>
      |tab id="tBreakdowns" label="Breakdowns">
        |group id="gCustGrp1" label="Breakdowns" >
            |button id="bSummary" size="large" label="Summary" imageMso="BlogHomePage"
                    |screentip = "Summary" onAction="CallSummary" 
			  |supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
		|button id="bFloor" size="large" label="Floor" imageMso="AlignJustify"
                    |screentip = "Floor" onAction="CallFloor" 
			  |supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
 		|button id="bDrawing" size="large" label="Drawing" imageMso="BlogCategories"
			  |screentip = "Drawing" onAction="CallDrawing"
			  |supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>          
		|button id="bZone" size="large" label="Zone" imageMso="AlignJustifyHigh"
                    |screentip = "Zone" onAction="CallZone"
			  |supertip = "Displays the Zone information on the Copy Ready Worksheet"/>                    
        |/group>
	  |group id="gCustGrp2" label="Import Data" tag="AdminGroup" >
            |button id="bChooseImportFile" size="large" label="Choose Import File" imageMso="BlogPublish"
                    |screentip = "Choose the file you need to import"
			  |supertip = "Runs the Choose File macro" onAction="CallChooseFile"/>    
		|button id="bImportData" size="large" label="Import Data" imageMso="CollapseAll"
			  |screentip = "Import Data" onAction="CallImportRawData" 
		  	  |supertip = "Runs the Import Data macro"/> 
		|button id="bHidAndSave" size="large" label="Hide Input Save As" imageMso="FileSave"
			  |screentip = "Hide Input tab and Save As" onAction="CallImportRawData" 
		  	  |supertip = "Runs the Import Data macro"/> 
 	  |/group>	
	  |group id="AlternateBaseFilter" label="Base" >
   		|button id= "AlternateBase" label = "Alternate" size="large"  							  
			  |onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
			  |supertip = "Switches Alternate field values between Alernate and Base" /> 
  	  |/group>
	  |group id="gInfo" label="Info" >
   		|button id= "bInfo" label = "Info" size="large"  							  
			  |onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
			  |supertip = "Show information about this file." /> 
  	  |/group>
      |/tab>
      |tab id="tBreakdowns2" label="Breakdowns2">
        |group id="gCustGrp3" label="Breakdowns2" >
            |button id="bSummary2" size="large" label="Summary" imageMso="BlogHomePage"
                    |screentip = "Summary" onAction="CallSummary" 
			  |supertip = "Displays the Summary information on the Copy Ready Worksheet"/>
		|button id="bFloor2" size="large" label="Floor" imageMso="AlignJustify"
                    |screentip = "Floor" onAction="CallFloor" 
			  |supertip = "Displays the Floor information on the Copy Ready Worksheet"/>
 		|button id="bDrawing2" size="large" label="Drawing" imageMso="BlogCategories"
			  |screentip = "Drawing" onAction="CallDrawing"
			  |supertip = "Displays the Drawing information on the Copy Ready Worksheet"/>          
		|button id="bZone2" size="large" label="Zone" imageMso="AlignJustifyHigh"
                    |screentip = "Zone" onAction="CallZone"
			  |supertip = "Displays the Zone information on the Copy Ready Worksheet"/>                    
        |/group>
	  |group id="AlternateBaseFilter2" label="Base" >
   		|button id= "AlternateBase2" label = "Alternate" size="large"  							  
			  |onAction="ShowBaseAlternateUserForm" screentip = "Toggles Alternate Values" imageMso="BlackAndWhiteInverseGrayscale"
			  |supertip = "Switches Alternate field values between Alernate and Base" /> 
  	  |/group>
	  |group id="gInfo2" label="Info" >
   		|button id= "bInfo2" label = "Info" size="large"  							  
			  |onAction="ShowInfoForm" screentip = "Information" imageMso="Info"
			  |supertip = "Show information about this file." /> 
  	  |/group>
      |/tab>
    |/tabs>
  |/ribbon>
|/customUI>

I hope this works this time!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top