1

This is my code to click the Save As button. I based my code on this answer: VBA interaction with internet explorer, but it does not seem to be working.

What can I do?

  Private Declare Function SetForegroundWindow Lib "user32" (ByVal HWND As     Long) As Long
    Dim HWNDSrc As Long



  Public Sub IE_Autiomation3()


Dim i As Long
Dim ie As Object
Dim objElement As Object
Dim objCollection, obj As Object
Dim GoObj, ClassObj As Object



' Create InternetExplorer Object
Set ie = CreateObject("InternetExplorer.Application")

HWNDSrc = ie.HWND


' You can uncoment Next line To see form results
ie.Visible = True




' Send the form data To URL As POST binary request
ie.navigate "http://www.otcmarkets.com/research/stock-screener"


' Wait while IE loading...
Do While ie.Busy
    Application.Wait DateAdd("s", 1, Now)
Loop

' Find 2 input tags:
'   1. Text field
'   <input type="text" class="textfield" name="s" size="24" value="" />
'
'   2. Button
'   <input type="submit" class="button" value="" />

Application.StatusBar = "Search form submission. Please wait..."

Set objCollection = ie.document.getElementsByTagName("input")

  Set ClassObj = ie.document.getElementsByTagName("a")







 ClassObj(53).Click

  WaitForIE ie, HWNDSrc, 1
       SetForegroundWindow HWNDSrc


 Application.SendKeys ("%s"), True

End Sub

Community
  • 1
  • 1

0 Answers0