VBA-HTML Dropdown list selecting value on drop down










0















I have a tool that opens this Web page dialog box that consists of a table that haswhen executed it will populate this object and hit a button to close the dialog box, however It seems it's not selecting physically the value from combo box. I've tried .SelectedIndex and .innerText but still when I hit the button to exit it still prompts me that I still haven't selected the data for this combo box. FOr example the combo box has values of "Select data", "Data 1" and "Data 2", of course upon opening the web page dialog box the default value of this combo box is "Select data" and when I run the code which focuses, clicks and gives value to this combo box as "Data 1"(from the code) and hit the button it will still prompt me that I still haven't selected any data and the combo box value will go from my selected data "Data 1" to "Select Data" again. I hope I explained it thoroughly but If you have clarification just let me know. I can't provide the URl since this is a system from the company I am supporting.



Below is my execution code and HTML of the web page dialog box:



Public Sub completeReserveLog() 
Dim iRes_Html As HTMLDocument
AssResScr="the title page of the URL"
Set iRes_Html = HtmlDocFromHandleJex(AssResScr, "Reserves")
If iRes_Html Is Nothing Then Exit Sub
With iRes_Html
'In this scenario is kinda confusing because I'm not really sure
'if what is really the name of my combox object. So I used these two: mvASSOC1_0 and mvASSOC1_1_0
.getElementById("mvASSOC1_1_0").Focus
.getElementById("mvASSOC1_0").Value = 1
.getElementById("mvASSOC1_1_0").Value = "Data 1"
.getElementById("mvASSOC1_1_0").Click
End With
End Sub


HTML(I'll incude the code for the two objects I'm confudsed determining the true object.



<TD class=mvTD><INPUT onbeforeactivate=storeCurVal() onbeforedeactivate=checkCurVal() onfocus=showMVCBO() id=mvASSOC1_1_0 class=mvFieldStyle 

onkeydown=RowUpDown() style="TEXT-ALIGN: left; BACKGROUND-COLOR: white" ondrop=callBAFieldValidated() value="Data 1" eventParams=""

validationName="Risk" decimals="" groupDigits="" cboName="mvASSOC1_0" max="" min="" validationType="text" keyfield="1" mandatory="0" code="1"></TD>

</TR></TBODY></TABLE></DIV></DIV><INPUT onchange=callBA() id=dbr3eportElement

style="HEIGHT: 1px; WIDTH: 1px; POSITION: absolute; LEFT: 0px; DISPLAY: none; TOP: 0px" name=dbreportElement fieldType="text"><SPAN id=rdesignbaisdrop

style="HEIGHT: 0px; WIDTH: 0px; POSITION: absolute; LEFT: 0px; Z-INDEX: 9999; DISPLAY: none; TOP: 0px; BACKGROUND-COLOR: transparent" name="rdesignbaisdrop"

fieldType="span">

</SPAN><SELECT onchange=hideshowMVCBO() onblur=hideMVCBO() id=mvASSOC1_0 class=mvFieldStyle onkeydown=hideMVCBO() style="WIDTH: 194px;

POSITION: absolute; LEFT: 43px; DISPLAY: none; TOP: 82px; VISIBILITY: visible" mvhFlag="_1" currentDIV="mvASSOC1_1_0"><OPTION value="">---Select Data---

</OPTION><OPTION selected value=1>Data 1</OPTION><OPTION value=2>Data 2</OPTION><OPTION value=4>Data 4</OPTION><OPTION value=12>Data 12</OPTION></SELECT>


I hope this supplies all the needed data.










share|improve this question






















  • your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

    – QHarr
    Nov 15 '18 at 5:23











  • I tried using that .FireEvent ("onchange") and still doesn't make any changes.

    – Midoriya Shonen
    Nov 15 '18 at 5:41











  • There are lots of events. Also, you may have more luck with using selenium basic.

    – QHarr
    Nov 15 '18 at 5:42











  • Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

    – Midoriya Shonen
    Nov 15 '18 at 5:55











  • Might be worth exploring for the future

    – QHarr
    Nov 15 '18 at 6:23















0















I have a tool that opens this Web page dialog box that consists of a table that haswhen executed it will populate this object and hit a button to close the dialog box, however It seems it's not selecting physically the value from combo box. I've tried .SelectedIndex and .innerText but still when I hit the button to exit it still prompts me that I still haven't selected the data for this combo box. FOr example the combo box has values of "Select data", "Data 1" and "Data 2", of course upon opening the web page dialog box the default value of this combo box is "Select data" and when I run the code which focuses, clicks and gives value to this combo box as "Data 1"(from the code) and hit the button it will still prompt me that I still haven't selected any data and the combo box value will go from my selected data "Data 1" to "Select Data" again. I hope I explained it thoroughly but If you have clarification just let me know. I can't provide the URl since this is a system from the company I am supporting.



Below is my execution code and HTML of the web page dialog box:



Public Sub completeReserveLog() 
Dim iRes_Html As HTMLDocument
AssResScr="the title page of the URL"
Set iRes_Html = HtmlDocFromHandleJex(AssResScr, "Reserves")
If iRes_Html Is Nothing Then Exit Sub
With iRes_Html
'In this scenario is kinda confusing because I'm not really sure
'if what is really the name of my combox object. So I used these two: mvASSOC1_0 and mvASSOC1_1_0
.getElementById("mvASSOC1_1_0").Focus
.getElementById("mvASSOC1_0").Value = 1
.getElementById("mvASSOC1_1_0").Value = "Data 1"
.getElementById("mvASSOC1_1_0").Click
End With
End Sub


HTML(I'll incude the code for the two objects I'm confudsed determining the true object.



<TD class=mvTD><INPUT onbeforeactivate=storeCurVal() onbeforedeactivate=checkCurVal() onfocus=showMVCBO() id=mvASSOC1_1_0 class=mvFieldStyle 

onkeydown=RowUpDown() style="TEXT-ALIGN: left; BACKGROUND-COLOR: white" ondrop=callBAFieldValidated() value="Data 1" eventParams=""

validationName="Risk" decimals="" groupDigits="" cboName="mvASSOC1_0" max="" min="" validationType="text" keyfield="1" mandatory="0" code="1"></TD>

</TR></TBODY></TABLE></DIV></DIV><INPUT onchange=callBA() id=dbr3eportElement

style="HEIGHT: 1px; WIDTH: 1px; POSITION: absolute; LEFT: 0px; DISPLAY: none; TOP: 0px" name=dbreportElement fieldType="text"><SPAN id=rdesignbaisdrop

style="HEIGHT: 0px; WIDTH: 0px; POSITION: absolute; LEFT: 0px; Z-INDEX: 9999; DISPLAY: none; TOP: 0px; BACKGROUND-COLOR: transparent" name="rdesignbaisdrop"

fieldType="span">

</SPAN><SELECT onchange=hideshowMVCBO() onblur=hideMVCBO() id=mvASSOC1_0 class=mvFieldStyle onkeydown=hideMVCBO() style="WIDTH: 194px;

POSITION: absolute; LEFT: 43px; DISPLAY: none; TOP: 82px; VISIBILITY: visible" mvhFlag="_1" currentDIV="mvASSOC1_1_0"><OPTION value="">---Select Data---

</OPTION><OPTION selected value=1>Data 1</OPTION><OPTION value=2>Data 2</OPTION><OPTION value=4>Data 4</OPTION><OPTION value=12>Data 12</OPTION></SELECT>


I hope this supplies all the needed data.










share|improve this question






















  • your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

    – QHarr
    Nov 15 '18 at 5:23











  • I tried using that .FireEvent ("onchange") and still doesn't make any changes.

    – Midoriya Shonen
    Nov 15 '18 at 5:41











  • There are lots of events. Also, you may have more luck with using selenium basic.

    – QHarr
    Nov 15 '18 at 5:42











  • Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

    – Midoriya Shonen
    Nov 15 '18 at 5:55











  • Might be worth exploring for the future

    – QHarr
    Nov 15 '18 at 6:23













0












0








0


0






I have a tool that opens this Web page dialog box that consists of a table that haswhen executed it will populate this object and hit a button to close the dialog box, however It seems it's not selecting physically the value from combo box. I've tried .SelectedIndex and .innerText but still when I hit the button to exit it still prompts me that I still haven't selected the data for this combo box. FOr example the combo box has values of "Select data", "Data 1" and "Data 2", of course upon opening the web page dialog box the default value of this combo box is "Select data" and when I run the code which focuses, clicks and gives value to this combo box as "Data 1"(from the code) and hit the button it will still prompt me that I still haven't selected any data and the combo box value will go from my selected data "Data 1" to "Select Data" again. I hope I explained it thoroughly but If you have clarification just let me know. I can't provide the URl since this is a system from the company I am supporting.



Below is my execution code and HTML of the web page dialog box:



Public Sub completeReserveLog() 
Dim iRes_Html As HTMLDocument
AssResScr="the title page of the URL"
Set iRes_Html = HtmlDocFromHandleJex(AssResScr, "Reserves")
If iRes_Html Is Nothing Then Exit Sub
With iRes_Html
'In this scenario is kinda confusing because I'm not really sure
'if what is really the name of my combox object. So I used these two: mvASSOC1_0 and mvASSOC1_1_0
.getElementById("mvASSOC1_1_0").Focus
.getElementById("mvASSOC1_0").Value = 1
.getElementById("mvASSOC1_1_0").Value = "Data 1"
.getElementById("mvASSOC1_1_0").Click
End With
End Sub


HTML(I'll incude the code for the two objects I'm confudsed determining the true object.



<TD class=mvTD><INPUT onbeforeactivate=storeCurVal() onbeforedeactivate=checkCurVal() onfocus=showMVCBO() id=mvASSOC1_1_0 class=mvFieldStyle 

onkeydown=RowUpDown() style="TEXT-ALIGN: left; BACKGROUND-COLOR: white" ondrop=callBAFieldValidated() value="Data 1" eventParams=""

validationName="Risk" decimals="" groupDigits="" cboName="mvASSOC1_0" max="" min="" validationType="text" keyfield="1" mandatory="0" code="1"></TD>

</TR></TBODY></TABLE></DIV></DIV><INPUT onchange=callBA() id=dbr3eportElement

style="HEIGHT: 1px; WIDTH: 1px; POSITION: absolute; LEFT: 0px; DISPLAY: none; TOP: 0px" name=dbreportElement fieldType="text"><SPAN id=rdesignbaisdrop

style="HEIGHT: 0px; WIDTH: 0px; POSITION: absolute; LEFT: 0px; Z-INDEX: 9999; DISPLAY: none; TOP: 0px; BACKGROUND-COLOR: transparent" name="rdesignbaisdrop"

fieldType="span">

</SPAN><SELECT onchange=hideshowMVCBO() onblur=hideMVCBO() id=mvASSOC1_0 class=mvFieldStyle onkeydown=hideMVCBO() style="WIDTH: 194px;

POSITION: absolute; LEFT: 43px; DISPLAY: none; TOP: 82px; VISIBILITY: visible" mvhFlag="_1" currentDIV="mvASSOC1_1_0"><OPTION value="">---Select Data---

</OPTION><OPTION selected value=1>Data 1</OPTION><OPTION value=2>Data 2</OPTION><OPTION value=4>Data 4</OPTION><OPTION value=12>Data 12</OPTION></SELECT>


I hope this supplies all the needed data.










share|improve this question














I have a tool that opens this Web page dialog box that consists of a table that haswhen executed it will populate this object and hit a button to close the dialog box, however It seems it's not selecting physically the value from combo box. I've tried .SelectedIndex and .innerText but still when I hit the button to exit it still prompts me that I still haven't selected the data for this combo box. FOr example the combo box has values of "Select data", "Data 1" and "Data 2", of course upon opening the web page dialog box the default value of this combo box is "Select data" and when I run the code which focuses, clicks and gives value to this combo box as "Data 1"(from the code) and hit the button it will still prompt me that I still haven't selected any data and the combo box value will go from my selected data "Data 1" to "Select Data" again. I hope I explained it thoroughly but If you have clarification just let me know. I can't provide the URl since this is a system from the company I am supporting.



Below is my execution code and HTML of the web page dialog box:



Public Sub completeReserveLog() 
Dim iRes_Html As HTMLDocument
AssResScr="the title page of the URL"
Set iRes_Html = HtmlDocFromHandleJex(AssResScr, "Reserves")
If iRes_Html Is Nothing Then Exit Sub
With iRes_Html
'In this scenario is kinda confusing because I'm not really sure
'if what is really the name of my combox object. So I used these two: mvASSOC1_0 and mvASSOC1_1_0
.getElementById("mvASSOC1_1_0").Focus
.getElementById("mvASSOC1_0").Value = 1
.getElementById("mvASSOC1_1_0").Value = "Data 1"
.getElementById("mvASSOC1_1_0").Click
End With
End Sub


HTML(I'll incude the code for the two objects I'm confudsed determining the true object.



<TD class=mvTD><INPUT onbeforeactivate=storeCurVal() onbeforedeactivate=checkCurVal() onfocus=showMVCBO() id=mvASSOC1_1_0 class=mvFieldStyle 

onkeydown=RowUpDown() style="TEXT-ALIGN: left; BACKGROUND-COLOR: white" ondrop=callBAFieldValidated() value="Data 1" eventParams=""

validationName="Risk" decimals="" groupDigits="" cboName="mvASSOC1_0" max="" min="" validationType="text" keyfield="1" mandatory="0" code="1"></TD>

</TR></TBODY></TABLE></DIV></DIV><INPUT onchange=callBA() id=dbr3eportElement

style="HEIGHT: 1px; WIDTH: 1px; POSITION: absolute; LEFT: 0px; DISPLAY: none; TOP: 0px" name=dbreportElement fieldType="text"><SPAN id=rdesignbaisdrop

style="HEIGHT: 0px; WIDTH: 0px; POSITION: absolute; LEFT: 0px; Z-INDEX: 9999; DISPLAY: none; TOP: 0px; BACKGROUND-COLOR: transparent" name="rdesignbaisdrop"

fieldType="span">

</SPAN><SELECT onchange=hideshowMVCBO() onblur=hideMVCBO() id=mvASSOC1_0 class=mvFieldStyle onkeydown=hideMVCBO() style="WIDTH: 194px;

POSITION: absolute; LEFT: 43px; DISPLAY: none; TOP: 82px; VISIBILITY: visible" mvhFlag="_1" currentDIV="mvASSOC1_1_0"><OPTION value="">---Select Data---

</OPTION><OPTION selected value=1>Data 1</OPTION><OPTION value=2>Data 2</OPTION><OPTION value=4>Data 4</OPTION><OPTION value=12>Data 12</OPTION></SELECT>


I hope this supplies all the needed data.







vba web dom automation html.dropdownlistfor






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 1:29









Midoriya ShonenMidoriya Shonen

1




1












  • your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

    – QHarr
    Nov 15 '18 at 5:23











  • I tried using that .FireEvent ("onchange") and still doesn't make any changes.

    – Midoriya Shonen
    Nov 15 '18 at 5:41











  • There are lots of events. Also, you may have more luck with using selenium basic.

    – QHarr
    Nov 15 '18 at 5:42











  • Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

    – Midoriya Shonen
    Nov 15 '18 at 5:55











  • Might be worth exploring for the future

    – QHarr
    Nov 15 '18 at 6:23

















  • your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

    – QHarr
    Nov 15 '18 at 5:23











  • I tried using that .FireEvent ("onchange") and still doesn't make any changes.

    – Midoriya Shonen
    Nov 15 '18 at 5:41











  • There are lots of events. Also, you may have more luck with using selenium basic.

    – QHarr
    Nov 15 '18 at 5:42











  • Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

    – Midoriya Shonen
    Nov 15 '18 at 5:55











  • Might be worth exploring for the future

    – QHarr
    Nov 15 '18 at 6:23
















your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

– QHarr
Nov 15 '18 at 5:23





your select element is the one with id mvASSOC1_0 . Though this and the preceeding 2 input elements have a lot of events associated. You may need to explore if any of these need .FireEvent "nameOfEvent" ....

– QHarr
Nov 15 '18 at 5:23













I tried using that .FireEvent ("onchange") and still doesn't make any changes.

– Midoriya Shonen
Nov 15 '18 at 5:41





I tried using that .FireEvent ("onchange") and still doesn't make any changes.

– Midoriya Shonen
Nov 15 '18 at 5:41













There are lots of events. Also, you may have more luck with using selenium basic.

– QHarr
Nov 15 '18 at 5:42





There are lots of events. Also, you may have more luck with using selenium basic.

– QHarr
Nov 15 '18 at 5:42













Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

– Midoriya Shonen
Nov 15 '18 at 5:55





Yeah. Selenium can't be an option since I'm working on a citrix server from a company and that could take a long time for approvals and installation to go through.

– Midoriya Shonen
Nov 15 '18 at 5:55













Might be worth exploring for the future

– QHarr
Nov 15 '18 at 6:23





Might be worth exploring for the future

– QHarr
Nov 15 '18 at 6:23












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311184%2fvba-html-dropdown-list-selecting-value-on-drop-down%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53311184%2fvba-html-dropdown-list-selecting-value-on-drop-down%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto