lflauretti
New Member
- Joined
- Sep 28, 2016
- Messages
- 1
<tbody style="margin: 0px; padding: 0px; border: 0px;">
[TD="class: votecell"] [/TD]
[TD="class: postcell"]I need to select an option from a javascript dropdown menu on IE with VBA, as the tittle says. In the code below, I have to select the option "SAO1636 - SAOJJ231C - Kontik Franstur" (Option value = "279-32")
The HTML code (The code continues to other dropdown menus, but only this one is necessary):
[/TD]
</tbody>
<tbody style="margin: 0px; padding: 0px; border: 0px;">
[TD="class: votecell"] [/TD]
[TD="class: postcell"]I need to select an option from a javascript dropdown menu on IE with VBA, as the tittle says. In the code below, I have to select the option "SAO1636 - SAOJJ231C - Kontik Franstur" (Option value = "279-32")
The HTML code (The code continues to other dropdown menus, but only this one is necessary):
Additional Info: Form Name = "Main", Form id = "Main"
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;"> < table border = "0" class = "gridsubbox" style = "background-color: #ffffff" width = "706" >
< tr >
< td >
< table border = "0" cellpadding = "1" cellspacing = "1" style = "border-top: #919b9c 0px solid" width = "100%" >
< tr >
< td rowspan = "9" style = "width:15%;" ></ td >
< td align = "right" class = "Celula" style = "width:10%;" >< span class = "u" > T </ span > AM </ td >
< td style = "width:75%;" >< select name = "FormAcessosDisponiveis1$cbTAM" onchange = "javascript:setTimeout('__doPostBack(\'FormAcessosDisponiveis1$cbTAM\',\'\')', 0)" id = "FormAcessosDisponiveis1_cbTAM" class = "CamposEdit2" style = "width:300px;" >
< option selected = "selected" value = "46-35" > RIO2460 - RIO2460 - UTILIZAR SABRE </ option >
< option value = "84-83" > SSA2726 - SSA2726 - Kontik ( Posto BR )</ option >
< option value = "147-116" > RIO3257 - RIOJJ237H - Petrobras Rio </ option >
< option value = "175-172" > SAO3586 - SAOJJ2836 - Leroy Merlin </ option >
< option value = "182-187" > SSA2823 - SSAJJ21BV - Maquina de Vendas </ option >
< option value = "189-244" > SSA2837 - SSAJJ21BZ - Bahia Minera &# 231 ;&# 227 ; o </ option >
< option value = "202-30" > SSA197 - SSAJJ218B - Kontik Franstur </ option >
< option value = "205-258" > SAO4018 - SAOJJ21Q3 - Novo Nordisk </ option >
< option value = "225-539" > RIO2758 - RIOJJ219X - Transpetro </ option >
< option value = "230-306" > SAO4227 - SAOJJ21V2 - Siemens </ option >
< option value = "231-288" > SAO4228 - SAOJJ21V3 - Skanska </ option >
< option value = "237-333" > RIO3504 - RIOJJ21J1 - Prudential </ option >
< option value = "241-313" > SAO4231 - SAOJJ21V6 - Kontik Net </ option >
< option value = "244-317" > SAO4233 - SAOJJ21V8 - Kontik Y </ option >
< option value = "246-337" > SSA2872 - SSAJJ21D0 - Engepack </ option >
< option value = "247-332" > SAO4232 - SAOJJ21V7 - Evonik </ option >
< option value = "256-29" > SSA75 - SSAJJ211Q - Kontik Franstur </ option >
< option value = "257-107" > SSA2776 - SSAJJ216S - BR Distribuidora SSA </ option >
< option value = "259-488" > SSA2912 - SSAJJ2133 - Kontik Franstur </ option >
< option value = "260-153" > SAO3585 - SAOJJ2837 - Angeloni </ option >
< option value = "261-183" > SSA2815 - SSAJJ2202 - Tam Operadora SSA </ option >
< option value = "262-131" > SSA2803 - SSAJJ217E - Celpe </ option >
< option value = "263-118" > RIO3256 - RIOJJ237G - Banco BBM </ option >
< option value = "264-94" > QOC142 - SAOJJ224K - Bradesco </ option >
< option value = "265-132" > SSA2802 - SSAJJ217D - Cosern </ option >
< option value = "266-127" > SAO3474 - SAOJJ258S - Eli Lilly </ option >
< option value = "268-130" > SAO3338 - SAOJJ2561 - Odebrecht </ option >
< option value = "270-99" > SAO3302 - SAOJJ255L - Arno </ option >
< option value = "271-136" > SAO3507 - SAOJJ259R - Reckitt Benckiser </ option >
< option value = "273-84" > SAO3078 - SAOJJ249W - Unibanco </ option >
< option value = "274-135" > RIO3297 - RIOJJ238F - Webb Negocios </ option >
< option value = "275-128" > SSA2775 - SSAJJ216R - Sala Vip Aeroporto </ option >
< option value = "276-174" > RIO3327 - RIOJJ246H - Kontik Franstur </ option >
< option value = "277-109" > SAO3400 - SAOJJ256T - Igreja </ option >
< option value = "278-538" > SAO4665 - SAOJJ257O - Videolar </ option >
< option value = "279-32" > SAO1636 - SAOJJ231C - Kontik Franstur </ option >
< option value = "287-368" > SAO4526 - SAOJJ22CN - Almart </ option >
< option value = "289-334" > RIO3503 - RIOJJ21J0 - BR Distribuidora </ option >
< option value = "294-373" > RIO3506 - RIOJJ21J3 - HRT OIL And GAS </ option >
< option value = "299-379" > SAO4527 - SAOJJ22CP - Camargo Correa </ option >
< option value = "300-399" > SAO4605 - SAOJJ210Q - Louis Dreyfus </ option >
< option value = "312-393" > SAO4600 - SAOJJ22E2 - TNT </ option >
< option value = "314-394" > SAO4603 - SAOJJ22E3 - Danone </ option >
< option value = "316-395" > SAO4604 - SAOJJ22E4 - Tavex </ option >
< option value = "319-403" > SAO4606 - SAOJJ22E5 - Raizen </ option >
< option value = "325-409" > RIO3567 - RIOJJ21KR - Amil </ option >
< option value = "333-428" > SAO4633 - SAOJJ22EH - Hypermarcas </ option >
< option value = "335-430" > SAO4525 - SAOJJ22CM - Ultragaz </ option >
< option value = "344-421" > SAO4230 - SAOJJ21V5 - Liquigas </ option >
< option value = "354-483" > SAO4664 - SAOJJ22FB - Bosch </ option >
< option value = "364-500" > SAO4695 - SAOJJ21NQ - Amadeus </ option >
< option value = "365-502" > RIO3569 - RIOJJ21KP - Anglo American RIO </ option >
< option value = "372-511" > SAO4696 - SAOJJ21NS - Sandvik </ option >
< option value = "384-243" > SAO3905 - SAO3905 - ZF do Brasil </ option >
</ select ></ td >
</ tr > </code>
[/TD]
</tbody>
Things I've tried on VBA:
ie.Document.getElementsByName("FormAcessosDisponiveis1$cbTAM").Value = "SAO1636 - SAOJJ231C - Kontik Franstur"<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">----------------
ie.Document.getElementbyID("FormAcessosDisponiveis1_cbTAM").Value = "SAO1636 - SAOJJ231C - Kontik Franstur"
----------------
ie.Document.getElementsByName("FormAcessosDisponiveis1$cbTAM").Value = "279-32"
----------------
ie.Document.forms("Main").getElementsByTagName("select")("FormAcessosDisponiveis1$cbTAM").Value = "84-83"
ie.Document.forms("Main").Item("FormAcessosDisponiveis1$cbTAM").FireEvent ("onChange")
----------------
ie.Document.getElementbyID("FormAcessosDisponiveis1_cbTAM").focus
ie.Document.getElementbyID("FormAcessosDisponiveis1_cbTAM").selectedindex = 5 'the number is not correct.. I just wanted to change the dropdown menu at this point</code>Anyway, I've looked in a bunch of websites and I'm not being able to solve this. I'd really appreciate if anyone could help me with this
Thank you for helping me
System Info IE9 / EXCEL 2010 / WIN 7