Link to home
Start Free TrialLog in
Avatar of dhalliday
dhalliday

asked on

Using vbscript to read from an excel file and populate a drop down list

I have an excel file that contains a list of names in one row and the distinguished name in another.


I need to read the file and output the names into the drop down box while having the distinguished name be the value for the selection.

The following was my attempt, but was unsuccessful.

strXLpath = "c:\managers.xls"
      
            Set objXL = CreateObject("Excel.Application")
            objXL.visible = False
            Set objWb = objXL.WorkBooks.Open(strXLpath)
            

            objWb.MoveFirst
            Do Until objWb.EOF
                  Set objOption = Document.createElement("OPTION")
                        objOption.Text = objXL.Rows(1).Value
                        objOption.Value = objXL.Rows(2).Value
                        mgrName.Add(objOption)
                        objWB.MoveNext
            Loop


ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the grade.

Regards,

Rob.