Difference between revisions of "A 'hello world' VBA program"

From Ribbon Commander Documentation
Jump to: navigation, search
(Creating a tab)
(Creating a tab)
Line 2: Line 2:
 
# Enter the code below in a standard VBA module
 
# Enter the code below in a standard VBA module
 
#: <syntaxhighlight lang="vb">
 
#: <syntaxhighlight lang="vb">
#: Public Sub CreateMyUI()
+
Public Sub CreateMyUI()
#:      
+
      
#:     ' Get a reference to the default rxCustomUI instance
+
     ' Get a reference to the default rxCustomUI instance
#:     Dim myCustomUI As rxCustomUI
+
     Dim myCustomUI As rxCustomUI
#:     Set myCustomUI = rxCustomUI.defaultInstance
+
     Set myCustomUI = rxCustomUI.defaultInstance
#:      
+
      
#:     ' Create a new tab
+
     ' Create a new tab
#:     Dim myTab As rxTab
+
     Dim myTab As rxTab
#:     Set myTab = myCustomUI.ribbon.tabs.Add(New rxTab)
+
     Set myTab = myCustomUI.ribbon.tabs.Add(New rxTab)
#:      
+
      
#:     ' Give the new tab a label
+
     ' Give the new tab a label
#:     myTab.Label = "My First Tab"
+
     myTab.Label = "My First Tab"
#:      
+
      
#:      
+
      
#:     ' Render the UI
+
     ' Render the UI
#:     myCustomUI.Refresh
+
     myCustomUI.Refresh
#:      
+
      
#: End Sub
+
End Sub
#: </syntaxhighlight>
+
</syntaxhighlight>

Revision as of 18:00, 10 March 2013

Creating a tab

  1. Enter the code below in a standard VBA module
    Public Sub CreateMyUI()

 

   ' Get a reference to the default rxCustomUI instance
   Dim myCustomUI As rxCustomUI
   Set myCustomUI = rxCustomUI.defaultInstance

 

   ' Create a new tab
   Dim myTab As rxTab
   Set myTab = myCustomUI.ribbon.tabs.Add(New rxTab)

 

   ' Give the new tab a label
   myTab.Label = "My First Tab"

   

   ' Render the UI
   myCustomUI.Refresh

 

End Sub