Creating our first button in VBA

From Ribbon Commander Documentation
Revision as of 18:09, 10 March 2013 by Rxdff15551 bb53 (Talk | contribs)

Jump to: navigation, search

Prerequisites

We recommend you go though A 'hello world' VBA program before going into this example.

Creating a button

  1. Public Sub CreateMyUI()
  2.  
  3.     With rxCustomUI.defaultInstance
  4.         ' Clear old state
  5.         .Clear
  6.  
  7.         ' Add a new tab
  8.         With .ribbon.tabs.Add(New rxTab)
  9.             .Label = "My First Tab"
  10.             ' Add a new group to our tab
  11.             With .groups.Add(New rxGroup)
  12.                 .Label = "My Group"
  13.  
  14.                 ' Add a new button to our group
  15.                 With .Buttons.Add(New rxButton)
  16.                     .Label = "My Button"
  17.  
  18.                 End With
  19.  
  20.             End With
  21.         End With
  22.  
  23.         ' Render the UI
  24.         .Refresh
  25.     End With
  26.  
  27. End Sub

Code Analysis

Adding a handler for the button's onAction delegate

Notes