473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Clearing a Javascript Message Box from VBA

BHo15
143 128KB
This issue has been around the block more than once. I've ready quite a bit over the last couple of days, but still have not been successful.

In controlling a website, and attempting to delete all of the selected items in a table, I get a Javascript pop-up which asks me if I really want to delete all of them (OK or Cancel). When this pops up, my vba code stops, and will not do anything else, until a human clicks the button.

Here is the HTML, Javascript, and my VBA...

HTML
Expand|Select|Wrap|Line Numbers
  1. <p>Delete:&nbsp;<input type="button" name="button_Delete" value="Delete" onclick="doDelete('c');">&nbsp;<span class="note">Deletes all selected charts.</span></p>
  2.                                                         <p>Move to:&nbsp;<select id="select_Lists" name="select_Lists">
  3.                                                                 <option value="trash" selected>-> Trash <-</option>
  4.                                                                 <option value="245">000-000 AEH</option>
Javascript
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:doDeleteList('169', 'C');">Delete List</a> |
My Code
Expand|Select|Wrap|Line Numbers
  1. Dim ieDelete As HTMLInputButtonElement
  2. Set ieDelete = IE.Document.getElementsByName("button_Delete")(0)
  3. Sleep (500)
  4. ieDelete.removeAttribute ("onClick")
  5. Sleep (500)
  6. ieDelete.setAttribute "onClick", "return true;"
  7. Sleep (500)
  8. ieDelete.Click

I have even tried printing the onClick values in the immediate window before and after setting it, but it continues to come up...
Expand|Select|Wrap|Line Numbers
  1. function onclick(event)
  2. {
  3. doDelete('c');
  4. }
...which pops up the message box.

While I think this sounds like a pretty good approach, I am open to anything. Thanks for looking.
Mar 20 '16 #1
1 1137
zmbd
5,501 Expert Mod 4TB
From what I am seeing, you are using the IE-Object, once the IEO is suspended by the message box, I think you're stuck from a VBA standpoint.

There may be an API call in the User32 library that could send the message to the window; however, that's only a guess on my part as I've not really used API calls in the past - BUT I know that some of our experts have so maybe one of them will have that knowledge.

The next option might be a shelled script using the WScript object that loops and waits for the popup... once again, not something I am really familiar with, The only reason this comes to mind is because I have used such a script to push front-ends down from the server to the user's pc so maybe there is a way to do the same for your cause.

Sorry, not much more I can do to help you.

Best of Luck
-Z
May 4 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Matt | last post by:
Is it possible to put XSL instructions inside JavaScript? For example, pop up a message box with the xml value: alert(value in xml); Approach #1: <script type="text/javascript">...
2
by: Pinot Grigio | last post by:
Not sure if this is the right place to ask this but... I am in Microsoft Updates. When I click "Details" of the update I get this message on the bottom of my screen:...
2
by: Joey | last post by:
Does anyone know how to create a javascript message box? I do not want to use 'alert' or 'window.alert'. That causes a message box with a warning icon. That is not appropriate for communicating a...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Which newsgroup deals with javascript? ----------------------------------------------------------------------- ...
4
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Internationalisation in javascript. ----------------------------------------------------------------------- ...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I protect a webpage in javascript?...
10
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Which newsgroups deal with javascript? ----------------------------------------------------------------------- ...
7
by: Bill H | last post by:
When I do website design I have my screen (on a PC) set for 1600 x 1200 or greater resolution so that I can have as many windows open as I need and not have to flip between them. The issue I have...
76
by: lorlarz | last post by:
Crockford's JavaScript, The Good Parts (a book review). This shall perhaps be the world's shortest book review (for one of the world's shortests books). I like Douglas Crockford (because I am a...
34
by: dhtml | last post by:
I made a change to the FAQ of javascript to EcmaScript. I got some feedback that the newsgroup is CLJ and the language is commonly referred to as JavaScript. Therefore, the word in the FAQ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.