SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 140 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


CHAPTER 3 n USING XML IN EXCEL 2007 128
1. Save your XML_Class.xlsm file as XML_Class_Ribbon.xlsm.
2. Open the VBE.
3. In the VBE, double-click ThisWorkbook to open the code window.
4. Type the following VBA subroutines, and then close the VBE:
Sub GetEmpDataBtn(ByVal ControlID As IRibbonControl)
Call GetEmpDept
End Sub
Sub AppendEmpDataBtn(ByVal ControlID As IRibbonControl)
Call AppendEmpDeptInfo
End Sub
Sub GetHRDataBtn(ByVal ControlID As IRibbonControl)
Call GetHREmployees
End Sub
Sub RefreshEmpDataBtn(ByVal ControlID As IRibbonControl)
Call RefreshEmps
End Sub
Sub RefreshHRDataBtn(ByVal ControlID As IRibbonControl)
Call RefreshHR
End Sub
Sub SaveEmpBtn(ByVal ControlID As IRibbonControl)
Call SaveEmps
End Sub
Sub SaveEmpNewFileBtn(ByVal ControlID As IRibbonControl)
Call SaveEmpsNewFile
End Sub
These procedures will be mapped to the controls on the custom ribbon via an XML
configuration file.
Save the workbook and close it.
Creating the XML File That Contains the Markup to Modify the UI
1. Create a folder called customUI.
2. Open a new file in the text editor of your choice, and save it as customUI.xml in the
customUI folder.
3. Add the following code to the customUI.xml file:
CHAPTER 3 n USING XML IN EXCEL 2007 129