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>
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(); });
Last edited: