473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Controlling combobox in Internet Explorer

BHo15
143 128KB
I'm having trouble controlling a combobox in Internet Explorer. I've done it before by using IE.Document.getElementByID("controlName").Selected Index = 2, and then IE.Document.getElementByID("controlName").FireEven t ("onchange"). But... that is not working this time. I keep getting error 438 on the .SelectedIndex line.

Here is a pared down version of my code...

Expand|Select|Wrap|Line Numbers
  1. Public Sub StockChartsTrades()
  2.     Dim IE As Object
  3.         Set IE = CreateObject("InternetExplorer.Application")
  4.         IE.Visible = True
  5.     Dim IEDoc As Object
  6.  
  7.     IE.Navigate "https://stockcharts.com/login/"
  8.     Set IEDoc = IE.Document.All("form_UserID")
  9.     IEDoc.Value = "MyUserName"
  10.     Set IEDoc = IE.Document.All("form_PW")
  11.     IEDoc.Value = "MyPassword"
  12.     IE.Navigate "https://stockcharts.com/def/servlet/ScanUI"
  13.     Set IEDoc = IE.Document.All("selectScan") 'This is the combobox
  14.     IEDoc.SelectedIndex = 2 'Code throws error 438 here
  15.     IEDoc.FireEvent ("onchange")
  16.  
  17.     Set IEDoc = Nothing
  18.     Set IE = Nothing
  19. End Sub

Here is the HTML from around this combobox...

Expand|Select|Wrap|Line Numbers
  1. <div id="scc-scanengine-head">
  2.      <!-- SELECT ALERT -->
  3.      <div class="form-item" id=selectScan">
  4.           <div class ="form-item-label">...</div>
  5.           <div class="selectric-wrapper selectric-selectric-scc">
  6.           <div class="selectric-hide-select">...</div>
  7.           <div class="selectric">
  8.                <span class="label">- Your Favorite Scans -</span>
  9.                <button type="button">...</button>
  10.           </div>
  11.           <div tabindex="-1" class="selectric-items">...</div>
  12.           <input tabindex="0" class="selectric-input" />
  13.      </div>
  14. </div>
  15. <!-- LIST ACTIONS -->
  16. <ul class="scanalert-actions">...</ul>
  17. </div>
  18.  
My apologies if the HTML is a bit botched. I typed it myself since I couldn't figure out how to copy it.

So... Why am I getting error 438 when trying to set the SelectedIndex?
Dec 31 '18 #1
3 1598
NeoPa
32,556 Expert Mod 16PB
In order to copy the HTML of a page in IE simply right-click and select View Source. That gives you selectable text.

No idea on your actual question as it needs someone who works in IE I expect.
Dec 31 '18 #2
BHo15
143 128KB
Thanks NeoPa. I was using Inspect and not View Source. That did the trick.

So, here is the unadulterated HTML...

Expand|Select|Wrap|Line Numbers
  1.         <div id="scc-scanengine-head">
  2.             <!-- SELECT ALERT -->
  3.             <div id="selectScan" class="form-item">
  4.                 <div class="form-item-label"><strong>Your Saved Scans</strong></div>
  5.                 <select id="favScans" class="selectric-scc" name="favScans" onchange="doLoadScan()">
  6.   <option value="default" selected="selected">- Your Favorite Scans -</option>
  7.       <option value="1798045" >3-01-01 Owned Scan</option>
  8.       <option value="1002282" >300-005 All Stocks that can be Purchased in PIA 1-14-2013</option>
  9.       <option value="1186206" >300-005 Buy Signal Scan 2015-05-06 #01-#05</option>
  10.       <option value="1005424" >300-006 All PIA Securities that had 8EMA-18SMA Cross 1-20-2014</option>
  11.       <option value="998271" >400-001 Sell Signal Active Portfolios - Bearish 50-Day Moving Average Cross</option>
  12.       <option value="998268" >400-001 Sell Signal Active Portfolios - Bearish MACD Crossover</option>
  13.       <option value="1001469" >400-003 Current Potentially Unhealthy Securities (<200D SMA) in Active Portfolios</option>
  14.       <option value="1001471" >400-003 Current Potentially Unhealthy Securities (<50 & 200D SMA) in Active Portfolios</option>
  15.       <option value="1001468" >400-003 Current Potentially Unhealthy Securities (<50D SMA) in Active Portfolios</option>
  16.       <option value="1302706" >AEH3</option>
  17.       <option value="1334840" >Custom MarketSmith 5-17-2016</option>
  18.       <option value="1320273" >EMA x SMA</option>
  19.       <option value="1340364" >Green Line Trading 5-30-2016</option>
  20.       <option value="1411269" >Industry Analysis - Bottom 11-8-2016</option>
  21.                 </select>
  22.             </div>
  23.  
  24.             <!-- LIST ACTIONS -->
  25.             <ul class="scanalert-actions">
  26.                 <li class="rename"><a id="rename-link" data-toggle="modal" href="#renameModal"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-eraser fa-stack-1x fa-inverse"></i></span><span class="hide-xs">Rename</span></a></li>
  27.                 <li class="save"><a href="javascript:doSaveScan();"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-download fa-stack-1x fa-inverse"></i></span><span class="hide-xs">Save</span></a></li>
  28.                 <li class="saveas"><a href="javascript:doAddModifyScan();"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-pencil-square-o fa-stack-1x fa-inverse"></i></span><span class="hide-xs">Save As</span></a></li>
  29.                 <li class="delete"><a href="javascript:doRemoveScan();"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-trash fa-stack-1x fa-inverse"></i></span><span class="hide-xs">Delete</span></a></li>
  30.                 <li class="viewall"><a href="javascript:doViewAll();"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-eye fa-stack-1x fa-inverse"></i></span><span class="hide-xs">View All</span></a></li>
  31.             </ul>
  32.         </div><!-- end of SCANENGINE HEAD -->
Dec 31 '18 #3
BHo15
143 128KB
I see from the HTML I pasted that there is an ID "favScans" which actually has the choice options listed below it (I did not see that one when I was working with it). I just tried the code with using favScans instead, but it would not let me interact with that element at all (error 70 Permission DENIED!!!).
Dec 31 '18 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already...
12
by: SunshineGirl | last post by:
I'm trying to receive events from a running instance of Internet Explorer. So far I've only been able to receive events from an instance I launch from code, but I need to receive events from all...
0
by: asadhussain | last post by:
I wrote a plugin to internet explorer that requires internet explorer to be shutdown and restarted. I figured out a way to shut down IE using the MSI and to start it back up using VBScript. I...
2
by: Morten Wennevik | last post by:
I use System.Diagnostics.Process.Start("IExplore", url); to start Internet Explorer when clicking a link label. However, this seems to work only for me, and not for two other people who both...
2
by: CathieC | last post by:
I have a websote developed using visual studio 2005 beta , .net version 2 i deploy my application to a server and it is run from client computers. One of the users gets the error "Internet...
2
by: Matt | last post by:
Hey Folks, We discovered an interesting behavior last week and after failing to find anything in the Knowledgebase or MSDN, I thought I would ping the community. We are in the process of...
3
by: VK | last post by:
Internet Explorer 7 beta 2 preview CNET Editor review: <http://reviews.cnet.com/Internet_Explorer_7_for_XP_SP2_Beta_2/4505-3514_7-31454661-2.html?tag=nl.e415> Summary (my personal review...
11
by: Wendy | last post by:
Hello, I have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row...
4
by: Salad | last post by:
Has IE gotten so complex you can't get the URL from IE? The code at http://www.mvps.org/access/api/api0051.htm used to work. Now it returns nothing. Is this due to having the...
0
by: Bill Corry | last post by:
I have been trying to get an instance of internet explorer to navigate to a website using the Navigate2 command. When the navigation request uses the Get method (just a URL) there is no problem. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.