XML question with check box

akramer08

Active Member
Joined
May 2, 2012
Messages
265
Ive been working with XML a bit lately and I have created a custom tab in excel 2007. I have two check boxes on that tab and I cant figure out how to have one automatically checked when I open the workbook. I dont know how to put XML text in a post so I just put it in a code box. If anyone can help that would be amazing.

Code:
<group id="group3" label="Display">
<checkBox id="myButton3" label="Show Volume" onAction="CallControl" /> 
<checkBox id="myButton4" label="Show Skids" onAction="CallControl2" /> 
</group>
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Nevermind that didnt work. Here is my current XML text

<group id="group3" label="Display">
<checkBox id="myButton3" label="Show Volume" onAction="CallControl" />
<checkBox id="myButton4" label="Show Skids" onAction="CallControl2" />
</group>
 
Upvote 0
Lets see if this works. If it shows up that is the text I have in the XML and the code is from a standard module in the workbook. It works perfectly fine in doing what it needs to do. I just dont know how to have the one with the button id "myButton3" to automatically be checked when the workbook opens.

HTML:
<group id="group3" label="Display"><checkBox id="myButton3" label="Show Volume" onAction="CallControl" /> <checkBox id="myButton4" label="Show Skids" onAction="CallControl2" /> </group>

Code:
Sub CallControl(control As IRibbonControl, pressed As Boolean)


    Select Case pressed
    Case True
        PressedState = True
' Show Volume
Application.ScreenUpdating = False
    Columns("I:L").EntireColumn.Hidden = False
    Columns("AK:AN").EntireColumn.Hidden = False
    Columns("AA:AA").EntireColumn.Hidden = False
    Columns("BC:BC").EntireColumn.Hidden = False
Application.ScreenUpdating = True


    Case False
        PressedState = False
' Hide Volume
Application.ScreenUpdating = False
    Columns("I:L").EntireColumn.Hidden = True
    Columns("AK:AN").EntireColumn.Hidden = True
    Columns("AA:AA").EntireColumn.Hidden = True
    Columns("BC:BC").EntireColumn.Hidden = True
Application.ScreenUpdating = True


    End Select
End Sub


Sub CallControl2(control As IRibbonControl, pressed As Boolean)


    Select Case pressed
    Case True
        PressedState = True
' Show Skids
Application.ScreenUpdating = False
    Columns("E:H").EntireColumn.Hidden = False
    Columns("N:Q").EntireColumn.Hidden = False
    Columns("Z:Z").EntireColumn.Hidden = False
    Columns("AG:AJ").EntireColumn.Hidden = False
    Columns("AP:AS").EntireColumn.Hidden = False
    Columns("BB:BB").EntireColumn.Hidden = False
Application.ScreenUpdating = True


    Case False
        PressedState = False
' Hide Skids
Application.ScreenUpdating = False
    Columns("E:H").EntireColumn.Hidden = True
    Columns("N:Q").EntireColumn.Hidden = True
    Columns("AG:AJ").EntireColumn.Hidden = True
    Columns("AP:AS").EntireColumn.Hidden = True
Application.ScreenUpdating = True


    End Select


End Sub
 
Upvote 0
Works great Andrew. That is a pretty informative page and really helps explain what certain things do and why.
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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