Difference between revisions of "A 'hello world' VBA program"
From Ribbon Commander Documentation
(→Code Analysis) |
|||
Line 26: | Line 26: | ||
== Code Analysis == | == Code Analysis == | ||
<syntaxhighlight lang="vb"> | <syntaxhighlight lang="vb"> | ||
− | + | Dim myCustomUI As rxCustomUI | |
− | + | Set myCustomUI = rxCustomUI.defaultInstance | |
− | + | </syntaxhighlight> | |
+ | |||
+ | [[rxCustomUI]] is at the top of the object model hierarchy. Here, we are holding on to the default rxCustomUI instance for the current office application session. | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="vb"> | ||
+ | Dim i As Long | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 17:13, 10 March 2013
Creating a tab
- 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
Code Analysis
Dim myCustomUI As rxCustomUI Set myCustomUI = rxCustomUI.defaultInstance
rxCustomUI is at the top of the object model hierarchy. Here, we are holding on to the default rxCustomUI instance for the current office application session.
Dim i As Long