1

Basically my requirement is to download the excel file from webpage through vba. I have written the code to login but unable to click on the list item. I need to iterate the loop through class and then list and tag a. So help me how can iterate through multiple option with vba.

I have attached the HTML source code i need to access hourly report from first list under Ul tag.

Sub DownloadIntraDayReport()`

Dim ie As New InternetExplorer 

ie.navigate "weblink" 

ie.Visible = True 

While ie.Busy DoEvents Wend 

Do Loop Until ie.readyState = READYSTATE_COMPLETE 

Set HTMLDoc = ie.document 

ie.document.getElementById("_58_login").Value = "username" 

ie.document.getElementById("_58_password").Value = "password" 

'ie.document.form().submit 

For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input") If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click 

Next 

End Sub

Source Code

Image of page and HTML

html

3
  • It would help if you showed more HTML and your code so far. I have given the general syntax for selecting by ID, if scraping with IE, below. Commented May 29, 2018 at 8:19
  • Please edit you code into the question. Then highlight all the code and press Ctrl + K to format between code tags. Commented May 29, 2018 at 9:17
  • I have put your code in between code tags but please review my comment about checking your layout as the above won't compile. I gave a suggested pastebin link for what it might look like. pastebin.com/DJ4QMV37 Commented May 29, 2018 at 10:59

1 Answer 1

1

Have you tried something like:

IE.document.getElementById("scheduledReportList").Click

Where IE is the instance of Internet Explorer being used to scrape the page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.