title: get value from selection in dropdown menu with variable name
body: <p>I have created a HTA page to get the status of workstations filtered from Active Directory.
  Currently I added buttons to perform specific actions for the workstation that has the button next to is.</p>
  
  <p>Since I'm adding more and more functions, I would like to use a dropdown box.
  The size of the list with workstations is variable depending on the input made by the user, so I've given the name of the worstation to the dropdown box.</p>
  
  <p>The problem I have now is that I cannot retreive the selected value in my VBScript code. 
  If I put <code>listbox1.value</code> I get the correct value in return.
  If I use place the name of the listbox in a variable like this, it doesn't work.</p>
  
  <pre><code>strlistbox = "listbox1
  listbox1.value
  </code></pre>
  
  <p>I get an error.</p>
  
  <p><a href="https://i.stack.imgur.com/d3VID.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d3VID.jpg" alt="enter image description here"></a></p>
  
  <p>This is part of the code I'm using. In total I have 760 lines, so I won't paste everything here.</p>
  
  <p>VBScript code:</p>
  
  <pre><code>Sub RunOption(strCPU)
    dim lstname
    dim intNumber
  
    lstname = "list"&amp;strCPU      'Value of lstname = listWPBED3702885
  
    msgbox listWPBED3702885.value    'If I try this messagebox, I get the value of the selected option form the dropdown list names "listWPBED3702885"
  
    intNumber = lstname.value 'This doesn't seem to work
  
    Select Case list 'intNumber
      Case 1   Do something
      Case 2   Do something
      Case 3   Do something
      Case 4   Do something
    End Select
  End Sub
  </code></pre>
  
  <p>HTML code:</p>
  
  <pre><code>strHTML = strHTML &amp; "&lt;td width='1'&gt;&lt;select class='select' size='1' title='list" &amp; _
            objRecordSet.Fields("Name") &amp; "' name='list' onChange=""RunOption('" &amp; _
            objRecordSet.Fields("Name") &amp; "')""&gt;"&amp; _
            "&lt;option value='0' selected&gt;Options...&lt;/option&gt;" &amp; _
            "&lt;option value='1'&gt;C:\ Drive&lt;/option&gt;" &amp; _
            "&lt;option value='2'&gt;Computer Management&lt;/option&gt;" &amp; _ 
            "&lt;option value='3'&gt;Event Viewer&lt;/option&gt;" &amp; _
            "&lt;option value='4'&gt;MAC Address&lt;/option&gt;" &amp; _
            "&lt;/select&gt;&lt;/td&gt;"
  </code></pre>