0

I am trying to click or call the function "Titlebar_simple_search" as shown on picture from VBA in Excel. It is on an intranet page on my workplace. I know I am far from the goal, but I am wondering if I can get some advice where to start.

Is HTMLdoc the best way? Should I first call the body class or div class that the function is located inside?

Any help is appreciated

print scrn from website

Private Sub CommandButton4_Click()

Dim IE As Object

 Set IE = New InternetExplorerMedium

   IE.Visible = True

 Url = "https://urlremovedduetoprivacy"

   IE.Navigate Url

    Do While IE.ReadyState = 4: DoEvents: Loop   'Do While
    Do Until IE.ReadyState = 4: DoEvents: Loop   'Do Until

Application.Wait (Now + TimeValue("0:00:05"))

Dim HTMLdoc As HTMLDocument

Set HTMLdoc = IE.Document
HTMLdoc.getElementById("simple_search_link").Click


End Sub
QHarr
  • 83,427
  • 12
  • 54
  • 101
Aaa
  • 1
  • Possible duplicate of [How do I use excel vba to click a link on a web page](https://stackoverflow.com/questions/24638533/how-do-i-use-excel-vba-to-click-a-link-on-a-web-page) – cyboashu Dec 06 '18 at 15:43

1 Answers1

0

Looks like you need to navigate a frame first and then get the element by its id:

Ie.document.getElementsByName("titlebar")(0).contentDocument.getElementById("simple_search_link").click
Nimantha
  • 6,405
  • 6
  • 28
  • 69
QHarr
  • 83,427
  • 12
  • 54
  • 101