- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Microsoft Access 2010 VBA Macro Programming in Microsoft Office
Microsoft Access 2010 VBA Macro Programming Encoding Denso QR Bar Code In C#.NET Using Barcode creator for .NET framework Control to generate, create QR-Code image in VS .NET applications. QR Code JIS X 0510 Maker In VS .NET Using Barcode printer for ASP.NET Control to generate, create QR image in ASP.NET applications. Figure 11-3 QR Code ISO/IEC18004 Encoder In .NET Framework Using Barcode printer for .NET framework Control to generate, create QR Code ISO/IEC18004 image in VS .NET applications. Generate QR-Code In VB.NET Using Barcode maker for VS .NET Control to generate, create QR Code 2d barcode image in VS .NET applications. The XML screen for a custom ribbon
Read EAN / UCC - 13 In Java Using Barcode reader for Java Control to read, scan read, scan image in Java applications. EAN 128 Printer In Java Using Barcode maker for Android Control to generate, create EAN 128 image in Android applications. When you open the form where you referenced the ribbon name property to this record, you will see that an extra entry now appears on the menu called Contoso Your screen should look like Figure 11-4 If you click this, you will see a ribbon with three groups in it The first and second groups that you see are exact copies of existing ribbon groups The Copy group is exactly the same as if you had clicked Home on the menu and then looked at the group Copy Similarly, the new Font group is exactly as shown when you click Home on the menu and see the Font group This part shows how you can leverage existing ribbon functionality to build a custom ribbon The third group in your new ribbon is a custom group, and this shows the real power of the ribbon By looking at the XML, you can see that three buttons have been created: ConBold, ConItalic, and ConUnderline If you try clicking any of these buttons, you will receive an error message stating Access cannot run the macro This is a piece of code defined by the onAction parameter, and at the moment this does not exist Painting Barcode In Objective-C Using Barcode creation for iPad Control to generate, create barcode image in iPad applications. Code-39 Creator In None Using Barcode printer for Online Control to generate, create Code 39 Full ASCII image in Online applications. 11: Working with the Ribbon
Data Matrix ECC200 Recognizer In .NET Framework Using Barcode scanner for .NET framework Control to read, scan read, scan image in .NET framework applications. Bar Code Recognizer In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. Figure 11-4 ECC200 Drawer In None Using Barcode maker for Online Control to generate, create Data Matrix ECC200 image in Online applications. Print UCC - 12 In .NET Using Barcode generation for ASP.NET Control to generate, create UPC-A Supplement 2 image in ASP.NET applications. Custom ribbon control Contoso
Make Barcode In None Using Barcode maker for Software Control to generate, create bar code image in Software applications. Printing Barcode In None Using Barcode generator for Font Control to generate, create barcode image in Font applications. Take some time to look through this sample piece of XML and see how it is constructed The code is shown here: Barcode Encoder In Java Using Barcode generator for Android Control to generate, create bar code image in Android applications. Data Matrix ECC200 Maker In None Using Barcode generator for Office Excel Control to generate, create Data Matrix ECC200 image in Excel applications. <customUI xmlns="http://schemasmicrosoftcom/office/2006/01/customui"> <ribbon> <tabs> <tab id="customTab" label="Contoso" insertAfterMso="TabHomeAccess"> <group idMso="GroupClipboard" /> <group idMso="GroupFontAccess" /> <group id="customGroup" label="Contoso Tools"> <button id="customButton1" label="ConBold" size="large" onAction="conBoldSub" imageMso="Bold" /> <button id="customButton2" label="ConItalic" size="large" onAction="conItalicSub" imageMso="Italic" /> <button id="customButton3" label="ConUnderline" size="large" onAction="conUnderlineSub" imageMso="Underline" /> </group> <group idMso="GroupEnterDataAlignment" /> <group idMso="GroupEnterDataNumber" /> Barcode Creator In Visual Studio .NET Using Barcode creator for ASP.NET Control to generate, create barcode image in ASP.NET applications. Make Bar Code In Objective-C Using Barcode creation for iPhone Control to generate, create barcode image in iPhone applications. Microsoft Access 2010 VBA Macro Programming
Code 39 Full ASCII Reader In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. Linear Barcode Generator In VB.NET Using Barcode creation for Visual Studio .NET Control to generate, create Linear 1D Barcode image in Visual Studio .NET applications. <group idMso="GroupQuickFormatting" /> </tab> </tabs> </ribbon> </customUI>
One of the most important points to bear in mind is that XML is case-sensitive and you need to follow the exact case when putting together your own XML; otherwise, it will not work Whereas in VBA this all gets taken care of via the editor, it is very important to get it right here The XML starts off with a root element: <customUI xmlns="http://schemasmicrosoftcom/office/2006/01/customui">
Elements are then defined for <ribbon> and <tabs> The tabs are effectively the menu items on the menu bar in Access There is then a tab definition for the new menu item called Contoso This line provides it with an internal ID, the name as it will appear on the menu bar, and where it will be positioned on the menu bar The next lines add in the ribbon groups for clipboard and font The third group added in is a custom one with a custom internal ID and a label to define it Buttons are then added in as child elements, providing custom internal IDs, labels, sizes, and images to use You can see how all these parameters work by comparing what you see in the ribbon group on the Access screen to the actual XML The custom group also has a closing element to finish it off: </group> This defines that the definition of the custom group has finished Curiously, three other groups are also defined after this, but their names do not exist in the ribbon model, so they have been ignored The XML is then finished off with closing tags for tab, tabs, ribbon, and Custom UI Creating Code for Your Custom Buttons
As already mentioned, the buttons in the ribbon custom group only produce an error message because they have no code to run You need to create code that utilizes the OnAction parameter from the custom ribbon control that was created To make your callback code work, you will need to add a reference in VBA to the Microsoft Office 120 Object Library To do this, click Tools | References in the VBE menu and scroll down the list of libraries to Microsoft Office 120 Object Library Tick the check box for this and click OK Usefully, the Custom UI Editor assists you in doing this This is one of the big advantages of using it instead of trying to work directly with the USysRibbons table If you look at the toolbar displayed, the icon on the far right has a label of Generate Callbacks if you hover your mouse over this Click this and you will see skeleton code for all three custom buttons within the XML Open the VBA Editor window in Access and insert a module by clicking Insert | Module Make sure you insert it in the workbook that has the custom ribbon; otherwise, it will not work
|
|