0

I want to click on a web page button via an excel button. After inspecting the element (which is the button), I get the following HTML code:

class="mstrLargeIconViewItemLink" onclick="return submitLink(this, event);" href="mstrWeb?evt=3010&src=mstrWeb.3010&loginReq=true&Server=L-MIS01&ServerAlias=L-MIS01%2FL-MIS02%2FL-MIS03&Project=MIS+International&Port=0">

I opened the main page where the button lies and tried every solution I could find on the interenet (expecially multiple versions of Document.getElementById()) but none worked.

The code I have is shown below (very basic until this point):

Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate2 "https://mis.lidl.net/MicroStrategy/servlet/mstrWeb"
IE.document.getElementbyID("mstrLargeIconViewItemName").href
omegastripes
  • 12,351
  • 4
  • 45
  • 96
Aderon
  • 43
  • 8
  • 1
    Navigate2 is asynchronous, you must wait for the document to fully load. The _DocumentComplete event is best for this, alternatively: https://stackoverflow.com/questions/23232488/detect-when-a-web-page-is-loaded-without-using-sleep – Alex K. Jan 22 '18 at 14:19
  • Also try `Set objButton = IE.document.getElementsByClassName("mstrLargeIconViewItemName")(0)` – omegastripes Jan 28 '18 at 17:00

0 Answers0