title: Is it possible to use ADO to load the value of an ActiveX control?
body: <p>I have the following code in an Excel document, let's call it Workbook1</p>
  
  <pre><code>' Extract data from a workbook without opening it in Excel.
  ' Returns a multidimensional array as a Variant
  '
  ' 30-Dec-2007, working in Excel 2000-2007
  '
  ' http://www.rondebruin.nl/ado.htm
  Public Function GetData( _
      sourceFile As String, _
      SourceSheet As String, _
      SourceRange As String _
  ) As Variant
      Dim rsCon As Object
      Dim rsData As Object
      Dim szConnect As String
      Dim szSQL As String
      Dim data As Variant
  
      ' Create the connection string.
      If val(Application.Version) &lt; 12 Then
          szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
                      "Data Source=" &amp; sourceFile &amp; ";" &amp; _
                      "Extended Properties=""Excel 8.0;HDR=No"";"
      Else
          szConnect = "Provider=Microsoft.ACE.OLEDB.12.0;" &amp; _
                      "Data Source=" &amp; sourceFile &amp; ";" &amp; _
                      "Extended Properties='Excel 12.0;HDR=NO;IMEX=1';"
      End If
  
      If SourceSheet = "" Then
          ' workbook level name
          szSQL = "SELECT * FROM " &amp; SourceRange$ &amp; ";"
      Else
          ' worksheet level name or range
          szSQL = "SELECT * FROM [" &amp; SourceSheet$ &amp; "$" &amp; SourceRange$ &amp; "];"
      End If
  
      On Error GoTo SomethingWrong
  
      Set rsCon = CreateObject("ADODB.Connection")
      Set rsData = CreateObject("ADODB.Recordset")
  
      rsCon.Open szConnect
      rsData.Open szSQL, rsCon, 0, 1, 1
  
      data = rsData.GetRows
      GetData = TransposeArray(data)
  
      ' Check to make sure we received data and copy the data
      ' Clean up our Recordset object.
      rsData.Close
      Set rsData = Nothing
      rsCon.Close
      Set rsCon = Nothing
      Exit Function
  
  SomethingWrong:
      Err.Raise 5, "", "The file name, Sheet name or Range is invalid of : " &amp; sourceFile &amp; "! Error"
      Exit Function
      On Error GoTo 0
  End Function
  </code></pre>
  
  <p>I use it to load data from a separate document (Workbook2). This works great, except now I need to access an ActiveX control in Workbook2, which is defined like this:</p>
  
  <p><a href="https://i.stack.imgur.com/DFcuS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DFcuS.png" alt="enter image description here"></a></p>
  
  <p>Is there any way to create an SQL statement to acccess the current state of the checkbox?</p>