title: Check dynamic checkboxes vbscript
body: <p>I have a question about the use of checkboxes in VBscript. I have a large excel file with a few columns with data in it. I build my HTML using vbscript and read the checkbox name out of the excel file and I this it in an array. Until there, everything works.
  When I want to check if the checkbox is checked, I get the error 'Object required' 'groupnames'
  Of course I know what I dit wrong, but I can't seem to find a solution. Is there anyone who could help me?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Check groups&lt;/title&gt;
  &lt;HTA:APPLICATION
    APPLICATIONNAME="Check groups"
    ID="Dynamically_check_groups"
    VERSION="1.0"/&gt;
  &lt;/head&gt;
  
  &lt;SCRIPT LANGUAGE="VBScript"&gt;
  Dim objExcel, objWorkbook, counter
  dim groupnames(90)
  counter = 0
  
  Sub Window_OnLoad
      Set objExcel = CreateObject("Excel.Application")
      Set objWorkbook = objExcel.Workbooks.Open ("D:\Groups.xls")
      dim strHTML, intRow
      For intRow = 2 to 90
          If objExcel.Cells(intRow,4).Value = "sport" Then
              if ObjExcel.Cells(intRow,5).Value = "vast" Then
                  strHTML = strHTML &amp; "&lt;input type="&amp;Chr(34)&amp; "checkbox"&amp;Chr(34)&amp; "  name="&amp;Chr(34)&amp; objExcel.Cells(intRow,2) &amp;Chr(34)&amp; "&gt;" &amp;objExcel.Cells(intRow,1) &amp;" &lt;br&gt;"
                  groupnames(counter) = objExcel.Cells(intRow,2).value
                  counter = counter + 1
              End if
          End if
      Next
      objExcel.Quit
      DataArea.InnerHTML = strHTML
  End Sub
  
  Sub Check_Groups
      Dim i, name
      For i = 0 to counter - 1  
          If groupnames(i).checked Then
              Msgbox groupnames(i) &amp; "was checked."
          End if
      Next
  
  End Sub
  &lt;/SCRIPT&gt;
  
  
  
  &lt;body bgcolor="white"&gt;
      &lt;table border="0" cellspacing="0" cellpadding="0"&gt;
          &lt;tr&gt;
              &lt;td valign="top"&gt;&lt;Div id="DataArea"&gt;&lt;/Div&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
          &lt;button style="width:200;height:50" name="chkgroups" id="chkgroups" accessKey="C" onClick="vbs:Check_groups"&gt;Controleer groepen&lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>