Here is a pared down version of my code...
Expand|Select|Wrap|Line Numbers
- Public Sub StockChartsTrades()
- Dim IE As Object
- Set IE = CreateObject("InternetExplorer.Application")
- IE.Visible = True
- Dim IEDoc As Object
- IE.Navigate "https://stockcharts.com/login/"
- Set IEDoc = IE.Document.All("form_UserID")
- IEDoc.Value = "MyUserName"
- Set IEDoc = IE.Document.All("form_PW")
- IEDoc.Value = "MyPassword"
- IE.Navigate "https://stockcharts.com/def/servlet/ScanUI"
- Set IEDoc = IE.Document.All("selectScan") 'This is the combobox
- IEDoc.SelectedIndex = 2 'Code throws error 438 here
- IEDoc.FireEvent ("onchange")
- Set IEDoc = Nothing
- Set IE = Nothing
- End Sub
Here is the HTML from around this combobox...
Expand|Select|Wrap|Line Numbers
- <div id="scc-scanengine-head">
- <!-- SELECT ALERT -->
- <div class="form-item" id=selectScan">
- <div class ="form-item-label">...</div>
- <div class="selectric-wrapper selectric-selectric-scc">
- <div class="selectric-hide-select">...</div>
- <div class="selectric">
- <span class="label">- Your Favorite Scans -</span>
- <button type="button">...</button>
- </div>
- <div tabindex="-1" class="selectric-items">...</div>
- <input tabindex="0" class="selectric-input" />
- </div>
- </div>
- <!-- LIST ACTIONS -->
- <ul class="scanalert-actions">...</ul>
- </div>
So... Why am I getting error 438 when trying to set the SelectedIndex?