VB Script message box help

Dakker221

New Member
Joined
Mar 26, 2018
Messages
5
Hi Everyone,

I wonder if you can help. I have a hta file which loads in a directory of files from a database.
When the user clicks the select box (dir2) I want a message box to display what option they selected. Can anyone help. This is my code:

Code:
<html>
   <head>
      <title></title>
      <link rel="stylesheet" type="text/css" href="" />
	  
      <HTA:APPLICATION
         ID="objHTAHelpomatic"
         APPLICATIONNAME=""
         SINGLEINSTANCE="yes"
         WINDOWSTATE="normal"
         MAXIMIZEBUTTON="No"
         SCROLL="NO"
         BORDER="Dialog"
         ICON = ""
         >
   </head>
******** Language="VBScript">


    Sub Window_******
	window.resizeTo 800,670
    End Sub


	Sub FillNames()
		Dim sConnect
		Dim objCmd
		Dim objRS


		sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=db.accdb;Persist Security Info=False"


		Set objCmd = CreateObject("ADODB.Command")
		objCmd.ActiveConnection = sConnect


		objCmd.CommandText = "SELECT [normalised_name] FROM tbl_dir;"


		Set objRS = CreateObject("ADODB.Recordset")
		Set objRS = objCmd.Execute
		
		While Not objRS.EOF
            Set objOption = Document.createElement("OPTION")
            objOption.Text = objRS("normalised_name")
            objOption.Value = objRS("normalised_name")
            dir_list.Add(objOption)
			objRS.MoveNext
		Wend
		
		objRS.Close
		Set objRS = Nothing
	End Sub
	
	Sub FillDesc
		Dim sConnect
		Dim objCmd
		Dim objRS


		sConnect = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=db.accdb;Persist Security Info=False"


		Set objCmd = CreateObject("ADODB.Command")
		objCmd.ActiveConnection = sConnect


		objCmd.CommandText = "SELECT [normalised_name] FROM tbl_dir;"


		Set objRS = CreateObject("ADODB.Recordset")
		Set objRS = objCmd.Execute
		
		While Not objRS.EOF
            Set objOption = Document.createElement("OPTION")
            objOption.Text = objRS("normalised_name")
            objOption.Value = objRS("normalised_name")
            dir_list.Add(objOption)
			objRS.MoveNext
		Wend
		
		objRS.Close
		Set objRS = Nothing
	End Sub
	
	
	Sub test(obj)
	msgbox dir2.value
	End Sub


*********>


****** ******="FillNames()">
	<div id="left">
	<h3>Directory</h3>
	<select id="dir2" size="5" name="dir_list" style="height:500;width:350" *******="test"></select>
	</div>
	<div id="right">
	<h3>Description</h3>
	<textarea rows="4" cols="50" style="width:400;height:300"></textarea>
	</div>
</body>


</html>
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top