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>
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

akramer08

Active Member
Joined
May 2, 2012
Messages
265
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>
 

akramer08

Active Member
Joined
May 2, 2012
Messages
265
wow that didnt work either. Well if anyone has any ideas it would be appreciated.
 

akramer08

Active Member
Joined
May 2, 2012
Messages
265

ADVERTISEMENT

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
 

akramer08

Active Member
Joined
May 2, 2012
Messages
265
Works great Andrew. That is a pretty informative page and really helps explain what certain things do and why.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,695
Messages
5,626,344
Members
416,174
Latest member
Cdecast

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
Top