How to respond to Website Message Box by Automating InternetExplorer with VBA Excel

VBAToexcel

New Member
Joined
Oct 10, 2013
Messages
2
Hi,

I am in the process of automating a process to fill up a website. With an Excel Macro, once I log into the website, insert a value in the required textbox and click the button, a website Message Box comes up with an alert asking me to confirm - Are you sure to update the value?

The execution of the macro stops at that level, resulting in no further execution of the macro.

On searching for the solution, I found out that a JavaScript function, the function which is executed on confirmation of the message box, should be called from macro instead of clicking the original button on the webpage.

I would like to have help in writing the code to call JavaScript function in Excel Macro.

Following is the HTML code from the view source page of the webpage.

<code id="questionViewInlineCode10-28269292-1" style="font-family: Courier, monospace; margin: 0px; padding: 0px; width: auto; zoom: 1; white-space: pre;">
Code:
******** type="text/javascript">    $('#reloadButton').click(function () {        $(this).text(            $(this).attr('name')        ).attr('disabled', 'disabled');        ****************.href = ****************.href.replace(/#.*$/, '');    });    SignalConsumer = function () {};    SignalConsumer.prototype = new TraderSettingsTool();    SignalConsumer.prototype.mySummaryPage = 'https://kvinvest.com/month/?action=template&tid=my_status';    SignalConsumer.prototype.isShowWaiver = 0;    SignalConsumer.prototype.amountPrecision = 1;       SignalConsumer.prototype._elements = {        "trading": {            "popup": $('#ssc-trading-popup'),            "amount": $('#ssc-trading-amount'),            "trade": $('#ssc-trading-trade'),            "provides": $('#ssc-trading-provides')        },        "slippage": {            "popup": $('#ssc-slippage-popup')        },        "provider": {            "popup": $('#ssc-provider-popup')        },        "consumers":{           "holder":   $('#ssc-consumers-holder'),           "template": $('#ssc-consumers-template'),           "form":     $('#ssc-consumers-form')        },        "subscribe": {            "server": $('#ssc-subscribe-server'),            "apply":  $('#ssc-subscribe-apply'),            "loader": $('#ssc-subscribe-loader'),            "info":   $('#ssc-subscribe-info'),            "form":   $('#ssc-subscribe-form'),            "description":   $('#ssc-subscribe-description')        },        "activate": {            "form": $('#ssc-activate-form'),            "slippage": $('#ssc-activate-slippage'),            "amount": $('#ssc-activate-amount'),            "popup": $('#ssc-activate-popup'),            "apply": $('#ssc-activate-apply'),            "cancel": $('#ssc-activate-cancel'),            "agree": $('#ssc-activate-agree'),            "sll": $('#ssc-activate-sll-value'),            "loader": $('#ssc-activate-sll-loader'),            "redirect": $('#ssc-activate-redirect')        },        "waiver": {            "popup": $('#ssc-waiver-popup'),            "agree": $('#ssc-waiver-agree'),            "apply": $('#ssc-waiver-apply'),            "subscribe": $('#ssc-waiver-subscribe')        },        "history": {            "log": $('#ssc-history-log')        }    };    SignalConsumer.prototype.bindEvents = function () {        var self = this;        this._elements.subscribe.form.find('form').submit(function () {            return false;        });// I THINK BELOW IS THE MESSAGE BOX POP UP        this._elements.subscribe.apply.click(function () {            if(!confirm('Are you sure to update?')){                return false;            }            self.subscribeToServer();            return false;        });        // On show history popup        this._elements.history.log.click(function () {            self.loadHistoryLog();            return false;        });        // --- ACTIVATION LOGIC ---        this._elements.activate.apply.click(function () {            self.applyActivateServer();            return false;        });        this._elements.activate.agree.change(function () {            var disabled = $(this).is(':checked') ? '' : 'disabled';            self._elements.activate.apply.attr('disabled', disabled);        });        this._elements.activate.cancel.click(function () {            self.hidePopUp();            return false;        });        this._elements.activate.redirect.click(function () {            self.hidePopUp();        });
</code>
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top