473,471 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select all in IE options element through VBA

Tabasco
25 New Member
Hello, i am trying to choose all the options in selection box in IE by using vba, i've no trouble choosing one value however when i'm trying to choose another value the first value becomes unmarkt, as if you would do it manually with a mouse. If you want to select several values with a mouse you have to hold down shift so.

The element has 290 option values so i would rather not want to write code to select every value but i suspect I can write a loop who either selects every value one by one, or, selects the first value and the last by holding down "shift".

Does anyone have an idea?
Jan 25 '13 #1
6 5783
Rabbit
12,516 Recognized Expert Moderator MVP
Assuming that multi select is enabled on the list, you have to loop through the options and set the selected property of each.
Jan 25 '13 #2
Tabasco
25 New Member
yes it is a multiple select. I get the loop to work however it seems im missing something because the options wont stay selected as they loop through the opions.

Expand|Select|Wrap|Line Numbers
  1. Dim m as double
  2. m = 0
  3.  
  4. X = ieApp.Document.getElementbyId("Element_ID").Length - 1
  5.  
  6. Do Until m = X
  7.  
  8. ieApp.Document.getElementbyId("Element_ID").Value = ieApp.Document.getElementbyId("Element_ID").Item([m]).Value
  9.  
  10.  
  11. m = m + 1
  12. Loop
  13.  
it seems im missing something in the loop to keep the values selected because now the loop says, "Select that value" and then "Select that value"

I need something like "Select that value and select that value" etc.
Jan 26 '13 #3
zmbd
5,501 Recognized Expert Moderator Expert
options in selection box
If you mean as in a group box and these are actually "option controls" or "option buttons" then these will work like radio buttons - this is by design. You can not use them as a multi select element
You have to unlink them from the selection box by changing the associations...
Closer Look: Using Multiple Groups of Radio Buttons
Visual Studio 2008
(see also the level before this link - you should consider check boxes instead)

I realize that this is a VB and not VBA reference; however, this still applies as it is common to both languages just the syntax varies.
Jan 26 '13 #4
Tabasco
25 New Member
I'm not trying to build a form i am trying to preset a number of selections on a web page on a selection box who look like this in scource. Multiple values are possible but i dont know how to select more then one at a time!


Expand|Select|Wrap|Line Numbers
  1.     <select size="5" name="ctl00$LeftMainRightContentPlaceHolder$MainContentPlaceHolderRemove$MainContentPlaceHolder$VariableSelector1$VariableSelector1$VariableSelectorValueSelectRepeater$ctl02$VariableValueSelect$VariableValueSelect$ValuesListBox" multiple="multiple" id="ctl00_LeftMainRightContentPlaceHolder_MainContentPlaceHolderRemove_MainContentPlaceHolder_VariableSelector1_VariableSelector1_VariableSelectorValueSelectRepeater_ctl02_VariableValueSelect_VariableValueSelect_ValuesListBox" class="variableselector_valuesselect_valueslistbox" onchange="UpdateNumberSelected('ctl00_LeftMainRightContentPlaceHolder_MainContentPlaceHolderRemove_MainContentPlaceHolder_VariableSelector1_VariableSelector1_VariableSelectorValueSelectRepeater_ctl02_VariableValueSelect_VariableValueSelect_ValuesListBox', 'ctl00_LeftMainRightContentPlaceHolder_MainContentPlaceHolderRemove_MainContentPlaceHolder_VariableSelector1_VariableSelector1_VariableSelectorValueSelectRepeater_ctl02_VariableValueSelect_VariableValueSelect_NumberValuesSelected', 'Stub','Cells')">
  2.                         <option value="0114">0114 Upplands Väsby</option>
  3.                         <option value="0115">0115 Vallentuna</option>
  4.                         <option value="0117">0117 Österåker</option>
  5.  
So how do i select for example these three values?
Jan 26 '13 #5
zmbd
5,501 Recognized Expert Moderator Expert
You are going to have tell us exactly which selection box control you're trying to use with VBA. The ones that I've normally seen in use act like radio buttons.

However, with that said, the only control I've seen that will allow this within the web-page is this: Selection Box Web component General tab (iwcl:WSelectionBox)
Jan 26 '13 #6
Rabbit
12,516 Recognized Expert Moderator MVP
The problem is that you're looping and setting the value of the select element. I said you need to loop through and set the selected property of the option element.
Jan 26 '13 #7

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

Similar topics

0
by: tomhath | last post by:
Can someone give an opinion whether this is a dumb approach? I want to generate a list of OPTION elements for s SELECT element, but I can't see any (clean) way to use a template on a list of...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
6
by: Christopher Benson-Manica | last post by:
I understand that the options property of a select element is an array of the options displayed by the select element. If that's so, then why can't I sort the array? Rather, I *want* to sort the...
2
by: abs | last post by:
Hello everybody. A piece of html code: <form ... > <select ....> <option .... <option .... </select> <select ....>
1
by: Leonardo Calado | last post by:
Hi, I have the following problem: I have 4 select fields like; <select id="choice_101" name="choice_101"> <option label="Will not attend" value="Will not attend" selected="selected">Will not...
6
by: Vortexmind | last post by:
Hi all I was wondering if this is possible in Javascript. I want to make a bookmarklet. When a user launches it, it tells the user to select an element in the page (for example a textarea) with...
3
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup...
1
by: madflytom | last post by:
Hello again all. I posted a question last night about dealing with <optgroups> in select boxes. We've changed directions, and now I need a little more help. Here's the scenario: Two select...
3
by: rwaynes | last post by:
Hi The code below is very simple but it doesn't seem to work correctly in IE6 on my pc (xp sp2). The alerts are blank in IE, all three of them. It works find in FF2 and opera9.5 alpha showing the...
0
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.