- How to configure Oracle VM Virtual Box Requirements: Oracle VM Virtual Box Website: https://www.virtualbox.org Level: Advance Knowledge: Windows Installations, adminsitrations Scenario Most of the windows installed today are in windows 7 or higher, due to this most of the program that were smoothly running from previous versions of windows like WindowsXP, Windows ME and other ...
- How to Customize and add ribbon in Microsoft Office 2010 Requirements: Microsoft Excel 2010, Office Custom UI Editor, Knowledge in XML, Microsoft Visual Basic(VBA) Programming Level: Basic Language: Microsoft Visual Basic for Applications (VBA) Office Custom UI Editor Office2010IconsGallery Basic Knowledge on Extensible Markup Language(XML) Scenario I have been working on how to create my own Ribbon control ...
- How to do Image Processing using AForge with COM+ Object Requirements: Visual Studio 2005, 2008, 2010 Programming Level: Advance Language: Visual Basic.Net AForge.dll(v 126.96.36.199) AForge.Imaging.dll(188.8.131.52) AForge.Math.dll(184.108.40.206) Project references AForge AForge.Imaging AForge.Imaging.Filters AForge.Math.Geometry System.Collections.Generic System.Drawing System.Drawing.Imaging System.Reflection Scenario Microsoft Visual Basic 6 as we all know is the ancestor of Visual Basic.Net the current versions of Visual Studio is 2012 upon this writing, and still due to the ...
- Did you know how to backup or restore MySQL Data? Requirements: MySQL Database Engine Programming Level: Moderate Language: MySQL Scenario: You want to backup your data at run-time without shutting down the mysql server (Binary Backup), in simply term you want to perform an online backup while other client is connected to server performing ...
- How to Check Alpha and numeric in a band of a string Requirements: Visual Studio 2005, 2008, 2010 Programming Level: Basic Language: Visual Basic.net Scenario I have been working to my new project recently for Inventory consolidation system, wherein it imports textfile format from other system for consolidation process. These Text file contains multiple column ...
- How to Lowlevel Format a flash drive Requirements: Low Level Formatting Software Brand Particular: Kingston Data Traveler or Any USB Flash Drive Download links: Apacer Low Level Formatter. Scenario: You have bought your USB Flash Drive and have used it for months when suddenly it no longer can write anything on it, when ...
- Loading xml from file to datagridview Requirements: Visual Studio 2005, 2008, 2010 Programming Level: Moderate Language: Visual Basic.Net Scenario An XML is stands for Extensible Markup Language, that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable . In a modern programming architecture xml plays an important ...
- Crystal Report in VS2010 Requirements: Visual Studio 2005, 2008, 2010 Programming Level: Moderate Language: Visual Basic.Net Project references CrystalDecisions.CrystalReports.Engine CrystalDecisions.ReportSource CrystalDecisions.Shared CrystalDecisions.Windows.Forms Scenario Crystal reports has been my partner since I have learned Programming. For me this is the best tool in creating professional looking reports that can even generate from easy to complex reporting. In this article I presume ...
- Converting datagridview row data into datatable Requirements: Microsoft Visual Studio 2005/2008/2010 Programming Level: Advance Language: Microsoft Visual Basic.Net Scenario: Datagridview is an essential component of visual studio wherein you could populate data on it by either a databinding or manual inserting of data. Being a visual basic programmer for almost 8 years, I'd rather choose ...
- Enhanced Entity Relationship Diagram (EER) Requirements: MySQL WorkBench 5.2 CE or later Language: SQL/Database Management System Level: Beginner Prerequisite: SQL Knowledge Definition: Entity Relationship Diagram or ER diagram is a data modeling method represented by symbols use to produce a relational database. A relational database is a database that conforms to relational model theory managed by ...
How to customize and add ribbon in Office 2010
How to Customize and add ribbon in Microsoft Office 2010
- Requirements: Microsoft Excel 2010, Office Custom UI Editor, Knowledge in XML, Microsoft Visual Basic(VBA)
- Programming Level: Basic
- Language: Microsoft Visual Basic for Applications (VBA)
- Office Custom UI Editor
- Basic Knowledge on Extensible Markup Language(XML)
Procedures on how to start with creating your own ribbon control and custom button
- If you have not done so, install Office Custom UI Editor the link provided above.
- Create an excel file and name it as “My First Custom Office Ribbon.xlsm”
- Open the Office Custom UI Editor application
- Read the Instruction provided below.
Instructions on how to do the procedure above
Working with Office Custom UI Editor
then goto to Insert menu and select “Office 2010 Custom UI Part“, and a childnode “CustomUI14.xml” has been added.
The Custom Ribbon XML
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon> <tabs> <tab id="customTab" label="SourceHints" insertAfterMso="TabHome"> <group id="SampleMenu" label="Sample SourceHints group tab"> <button id="btnRunMacro" label="Run sample Macro" imageMso="ChartResetToMatchStyle" size="large" onAction="RunMacro" supertip="This Button rans macro created using VBA." /> </group> <group idMso="GroupClipboard" /> <group idMso="GroupFont" /> <group idMso="GroupEnterDataAlignment" /> <group idMso="GroupEnterDataNumber" /> <group idMso="GroupQuickFormatting" /> </tab> </tabs> </ribbon> </customUI>
Now copy and paste the xml above on the right pane of Custom UI Editor exactly as it was created in here, you have noticed “CustomTab” id labeled as “SourceHints” is a ribbon tab that will be created on an Excel menu, the “SampleMenu” group id is a custom group I created, the four groups: GroupClipboard, GroupFont, GroupEnterDataAlignment, GroupEnterDataNumber, GroupQuickFormatting are system groups embedded on excel application in which we can add system group on our custom menu. The finish Custom Ribbon is shown below:
Visual Basic for Application Simple Macro Code
If you have not done so
Public Sub RunMacro(control As IRibbonControl) Dim msg As String On Error GoTo RunErr msg = "Today is: " & Format(Now, "dddd") & ", " & Format(Now, "mmmm dd, yyyy") & vbCrLf msg = msg & "VBA is a powerful tool to enhance " & vbclrf msg = msg & "Office capabilities beyond your needs." MsgBox msg, vbInformation Or vbOKOnly, "VBA is Fun" RunExit: Exit Sub RunErr: MsgBox "Error: " & Err.Description, vbCritical, "Error" Resume RunExit End Sub
you noticed on RunMacro Subroutine we have a parameter “control As IRibbonControl” this control is a type IRibbonControl in which represents the button that we have created in Custom UI Editor via XML, as you click the “Run Sample Macro” button the subroutine “RunMacro” will be executed and evaluated, you can do anything you want here as you do in Microsoft Visual Basic 6.0 IDE.
Last thing you need to do
Sample Microsoft Excel Macro-Enabled File
Kindly like our Fan Page at: Like Us at SourceHints
How to customize and add ribbon in Office 2010,