IE - Selecting multiple Selections from Select element

Hi everyone,
I have some code below, that is used to select an option from a drop down list and submit a form, which works fine. My work has just changed the drop down box to a multi select box. How can I change the following lines to select multiple items in one go?
[code]For i = 1 To 200
myIE.Document.forms(mySearchForm).elements(mySearchInput).Value = Sheets("Currencies").Cells(i, 3).Value
Next i[/code]
I thought the above code should work, but each time it loops, it selects a new value instead of adding to the current selection.

The full code in current use is this:

[code]Sub AddCur()
Sheets("Auto Currencies").Unprotect
Sheets("Auto Currencies").Cells(13, 13).Value = "0"
Const myPageTitle As String = "Manage Currency Codes"
Const mySearchForm As String = "manageCurrency"
Const mySearchInput As String = "currencyCode"
Const myStatusInput As String = "currencyStatus"
Const myStatus As String = "002"
Const myButton As String = "Add"
Dim i As Integer
Dim AIndex As Double
Dim AddAm As Double

Dim myIE As SHDocVw.InternetExplorer

'check if page is already open
Set myIE = GetOpenIEByTitle(myPageTitle, False)

AddAm = 100 / Application.CountA(Sheets("Currencies").Range("C:C"))

For i = 1 To 200
If (Sheets("Currencies").Cells(i, 3).Value = "") Then
Exit For
End If
With myIE.Document.forms(mySearchForm)
'enter search term in text field
.elements(mySearchInput).Value = Sheets("Currencies").Cells(i, 3).Value
'press button "Go"
.elements(myStatusInput).Value = myStatus
End With
Dim vReadyState 'check if page is fully loaded. 4 = loaded
vReadyState = 0
Application.Wait DateAdd("s", 2, Now)
Do Until vReadyState = 4
vReadyState = myIE.ReadyState
AIndex = AIndex + AddAm
Sheets("Auto Currencies").Cells(13, 13).Value = AIndex
Next i
Sheets("Auto Currencies").Cells(13, 13).Value = ""
Sheets("Auto Currencies").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
MsgBox ("Add all currencies complete.")
End Sub[/code]
Many thanks for your help

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!