Microsoft Office 2000 Developer |
It is possible to bind an object to data using the BindingCollection object. This example shows how to use the BindingCollection object to interact with an Excel Range object.
To bind a Range object to the BindingCollection object
Option Explicit
' Declare a BindingCollection object
Private bcProducts As BindingCollection
Private Sub CommandButton1_Click()
Set bcProducts = New BindingCollection
Set bcProducts.DataSource = ADODC1
bcProducts.Add Range("A1"), "Value", "ProductName"
End Sub
The Range object will now be bound to the data source using the BindingCollection object. Clicking the ADO Data Control will change the value of the cell.