Difference between revisions of "Using XML in VBA"

From Ribbon Commander Documentation
Jump to: navigation, search
(Created page with "== Introduction == Dynamic RibbonX controls are both * Serializable to XML * Instantiatable from XML == Serializing to XML == <syntaxhighlight lang="vb"> Public Sub Serializi...")
 
(Serializing to XML)
Line 14: Line 14:
 
     ' Build up state
 
     ' Build up state
 
     With myButton
 
     With myButton
         .ID = "my_button"
+
         .label = "My Button"
        .Label = "My Button"
+
         .enabled = rxTrue
         .Enabled = rxTrue
+
        .Visible = rxTrue
+
        .keytip = "K"
+
        .ScreenTip = "My button screentip"
+
 
         .supertip = "My button supertip"
 
         .supertip = "My button supertip"
 
          
 
          
Line 31: Line 27:
 
The following xml code is printed out to the debug window:
 
The following xml code is printed out to the debug window:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
<button screentip="My button screentip" supertip="My button supertip" enabled="true" label="My Button" visible="true" keytip="K" id="my_button"></button>
+
<button supertip="My button supertip" enabled="true" label="My Button"></button>
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 22:57, 14 March 2013

Introduction

Dynamic RibbonX controls are both

  • Serializable to XML
  • Instantiatable from XML

Serializing to XML

Public Sub SerializingButton()
 
    ' Create a new button
    Dim myButton As rxButton
    Set myButton = New rxButton
 
    ' Build up state
    With myButton
        .label = "My Button"
        .enabled = rxTrue
        .supertip = "My button supertip"
 
        ' Serialize to XML
        Debug.Print .XML
    End With
 
End Sub

The following xml code is printed out to the debug window:

<button supertip="My button supertip" enabled="true" label="My Button"></button>