473,320 Members | 1,969 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,320 software developers and data experts.

Need help clicking an HTML button in VBA

BHo15
143 128KB
I'm trying to click an HTML button (to select all items in a table), but the HTML is in a format that I am not accustomed to. The button does not have a visible (at least to me) ID or name. Here is the HTML section I am dealing with...

Expand|Select|Wrap|Line Numbers
  1. <div class= "module module-scc-favorites pkg">
  2.     <h3 class="module-header">ChartList Contents:</h3>
  3.     <table class="scc-typical scc-zebra" id= "scc-favorites-edittable" border="0" cellspacing="0"">...</table>
  4.     <input onclick="doSelectAll();"type="button" value="Select All Charts"/>
  5. </div>
Here is what I have tried...

Expand|Select|Wrap|Line Numbers
  1. Set IEDoc = IE.Document.getElementByID("scc-favorites-edittable").getElementsByTagName("Input")(0)
  2. IEDoc.Click
  3.  
and...

Expand|Select|Wrap|Line Numbers
  1. Set IEDoc = IE.Document.getElementsByClassName("module module-scc-favorites pkg")(0).getElementsByTagName("Input")(0)
  2. IEDoc.Click
  3.  
Neither has worked. Not sure what to try next. Any help would be appreciated.
Mar 17 '16 #1
1 2644
BHo15
143 128KB
For those that are interested, I found the solution.

First off... I initially wrote the HTML by hand (copied), because I was in a hurry, and having trouble copying and pasting. Therefore, I made some pretty significant errors. So... Here is the correct HTML.

Expand|Select|Wrap|Line Numbers
  1. <div class="module module-scc-favorites pkg">
  2.     <h3 class="module-header">ChartList Contents:</h3>
  3.     <table id="scc-favorites-edittable" class="scc-typical scc-zebra" cellspacing="0" border="0"></table>
  4.     <input type="button" onclick="doSelectAll();" value="Select All Charts"></input>
  5.     ::after
  6. </div>

Here is the vba that what worked for pushing the button and selecting all elements in the table.

Expand|Select|Wrap|Line Numbers
  1.         Set IEDoc = IE.Document.getelementsbytagname("input")
  2.  
  3.         For Each varInput In IEDoc
  4.             If (varInput.getattribute("value") = "Select All Charts") Then
  5.                 varInput.Click
  6.                 Exit For
  7.             End If
  8.         Next varInput
Mar 18 '16 #2

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

Similar topics

13
by: Botao | last post by:
Hi, Every Guru, I'd like to put a button on a page. When clicking the button, the table below it gets selected so the user can do Ctrl C to copy the entire table without using the mouse to...
2
by: sivashankar | last post by:
hi all, -i need how to laod a execl by clicking a button. -and pass the data to that excel page. -can anyone give me the code thx in advance sivashankar.R
1
by: Bishoy George | last post by:
I have an html button that reads a text box and runs a javascript. I made a Required Validator on that text box , any web button follows that validator. My html button does not follow the...
10
by: mjahabarsadiq | last post by:
I would like to reload the page when it is redirected by the browser's Back or Forward button. I tried the following but it does not works. <link rel="prev" href="url"> <link rel="next"...
6
by: Paul Furman | last post by:
I'm getting incorrect response when hitting the enter key instead of actually clicking the button on a form. It activates but the post data isn't being sent I think. The php generated page...
13
by: maddiashok | last post by:
Hi, How to redirect the Html page in spcicific location, while clicking hyperlink or link button. Please help me i am fresher for Asp.net. its urgent Thank you....
1
oranoos3000
by: oranoos3000 | last post by:
hi i,m writing a script for chat room i,d like to with clicking close button of browser user is exited from site meaning of this say is with clicking close button all of session variable is...
11
by: bala venkata siva ram kum | last post by:
I am facing a problem while clicking edit button of a gridview.after clicking edit button it is displaying empty textboxes. I need old values in that textboxes. Here i used 3-tier architecture....
4
by: bala venkata siva ram kum | last post by:
Hi friends, I need to get confirm message box while clicking delete button of gridview.please tell me the solution.
2
by: SwatiGV | last post by:
I want to update the subform upon clicking a button (Run) in the main form. The Run button on the main form is updating a query(Filter Region). This query is the Source Object of the Subform. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.