I’m a beginner and desperately seeking for help. I would kindly request your support and apologize in advance for the poor wording and eventual lack of info (again, I’m a rookie). I’m building an Excel macro to fill in a (private) webpage and after filling in the requested data, I’m also able to call the javascript function that submits the data/form. However, it appears a “Message from webpage” that I’m unable to confirm (always "ok"/enter) or simple skip. The Macro just stops and I can’t do anything without clicking manually in the “ok” button. I’ve spend several hours searching and trying different solutions but nothing seems to work, probably due to my poor skills. Hereunder I send the code that is beating me hard (hope is enough). Looking forward for your help
MY CODE
DIM HTMLdoc As MSHTML.HTMLDocument
' Submits data but gets stuck in the popup message box
HTMLdoc.all.Item
Call HTMLdoc.parentWindow.execScript("licitarLeilao();", "JScript")
WEBPAGE
...
function licitarLeilao(){
var ultimaLicitacao = document.getElementById('ultimaLicitacao').value;
var valorLicitar = document.getElementById('valorLicitar').value;
if(ultimaLicitacao == ' -- '){
ultimaLicitacao = document.getElementById('valorBase').value;
}
var racio = toNum(valorLicitar) / toNum(ultimaLicitacao);
if (racio < 1.5) {
if(!confirm('Confirma o valor de licitação (' + valorLicitar +' eur.) do leilão?')){
return false;
}
}
else {
if(!confirm('ATENÇÃO!! O valor de licitação é muito superior à última licitação. \n\n Confirma o valor de licitação (' + valorLicitar +' eur.) do leilão?')){
return false;
}
}
var flow = document.getElementById('flow');
flow.value = '8';
document.formulario.submit();
}
You can try overwriting
window.confirm
with a different functionality:In a test page that worked OK for me.
NOTE: if there's any other code on the web page which uses
confirm
then the functionality of that code may be impacted.