BindingAdded Event

Microsoft Office Web Components Visual Basic

BindingAdded Event

Occurs when a new or existing XmlDataBinding object is added or modified through the Edit Query command.

Private Sub Spreadsheet1_BindingAdded (BindingId)

BindingId   The unique ID of an XmlDataBinding object.

Remarks

The BindingId is automatically generated by the Spreadsheet component when you bind to a data retrieval service connection (.uxdc) file. Microsoft Excel also automatically generates the BindingId when you use Excel to create a data-bound spreadsheet and later save it as an XML Spreadsheet file. In the XML Spreadsheet file, the XML fragment that contains the BindingId looks something like the following:

<x2:Binding x2:ID="Bind_id89929" x2:LoadMode="Normal" x2:Async="False">

You can also manually assign a BindingId value by adding the relevant XML fragment that contains data-binding details into an XML Spreadsheet file.

Example

The following example in Microsoft Visual Basic Scripting Edition (VBScript) tracks the number of XmlDataBinding object events and displays the BindingId of the given event when it occurs.

    'global XmlDataBinding object BindingAdded event counter.
Dim gintCounterBindingAdded
gintCounterBindingAdded = 0

Sub Spreadsheet1_BindingAdded(BindingId)

    gintCounterBindingAdded = gintCounterBindingAdded + 1
    MsgBox ("BindingAdded and BindingID is: " & BindingId)

End Sub