-
Apr 7th, 2021, 08:18 PM
#1
Thread Starter
New Member
VBA Internet Explorer Click a button
Hi there, im using vba to access internet explorer, im having problem to click the button "导出“ from the span as shown as above picture, which allows me to export current table out from this website. Please help, thanks.
-
Apr 8th, 2021, 04:18 AM
#2
Re: VBA Internet Explorer Click a button
what code have you tried? and what results?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 8th, 2021, 06:59 PM
#3
Thread Starter
New Member
Re: VBA Internet Explorer Click a button
Hi I have tried the following:
option 1____________________________________________
Set oElementCollection = objIE.document.getElementById("btnExport")
For Each link In oElementCollection
If link.innerHTML = "导出" Then
link.Click
Exit For
End If
Next link
option 2 ____________________________________________
objIE.document.getElementById("btnExport").Click
____________________________________________
All of the above options do not work.
-
Apr 9th, 2021, 03:13 AM
#4
Re: VBA Internet Explorer Click a button
if you want to pm me with a link to the actual site, include username and password, i will have a look and test
other than that, if the button is on a form, have you tried tried to submit the form?
many sites try to make it as difficult as possible to automate their pages, even if the button can be clicked, it may need some other javascript or other to authenticate that the button was actually clicked by mouse
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 9th, 2021, 03:45 AM
#5
Thread Starter
New Member
Re: VBA Internet Explorer Click a button
Sorry I cant provide the username and password, this is company internal website. the button is on top of a table. Im not sure if it is a form or not. Any other suggestion I can try?
-
Apr 9th, 2021, 04:04 AM
#6
Re: VBA Internet Explorer Click a button
this is company internal website
as it is internal, ask whoever designed it to provide an API, not much anyone external can do anything to help, can't see the html code of the page or test against the site
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|