Results 1 to 8 of 8

Thread: How can VBA fill-in web form??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Regular
    Joined
    Jul 2008
    Posts
    38
    Location
    Thank You for your tip... I've made some little progress now, using the SENDKEYS idea... although there must be a better way to do it, but this seems to be working. At least I can get the web-based report to RUN.


    QUESTION 1:
    what is the VBA code to simply activate or focus the Internet Explorer window so that the SENDKEYS actually get sent to THAT WINDOW (and not to my VBA program code window!)

      With IE
        .Navigate "http://intranet.urlhere.com/cgi/swr/...pl?report=8541"
        .Visible = True
        Do Until IE.readyState = READYSTATE_COMPLETE
            DoEvents
        Loop
        Do Until .Document.readyState = "complete"
            DoEvents
        Loop
        SendKeys ("{TAB}")
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{TAB}")
        ' Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{DOWN}")                  ' selects EXCEL download format
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{TAB}")                   ' move to the STARTING DATE field
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{TAB}")                   ' move to the ENDING DATE field
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{DOWN}")
        SendKeys ("{TAB}")                   ' move to the ENTER field
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{ENTER}")                ' run the report!
        '''  NOW HERE IS WHERE I NEED MORE HELP AT THIS POINT, the web-based report has been requested and now I am 
        'WAITING FOR the little     "FILE DOWNLOAD"  window to appear, which indicates that the report is done running and now I need to SAVE IT as .XLS file.
        'THERE MUST BE SOME WAY TO automatically look for this WINDOW TO APPEAR... SINCE THE AMOUNT OF TIME IT TAKES VARIES A LOT. ' this is not working yet!  
        HOW TO FOCUS OR SELECT THIS "FILE DOWNLOAD"  window SO THE SENDKEYS DATA GOES TO IT?
        SendKeys ("{TAB}")
        SendKeys ("{TAB}")                  ' move to SAVE field
        SendKeys ("{ENTER}")                ' brings up the file SAVE dialog box
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("2008.06_Report")
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys ("{ENTER}")                 ' SAVE IT!
    QUESTIONS:

    How to automatically tell once the "FILE DOWNLOAD" window appears? Please show how this can be done in VBA code... there must be a way...

    How to select or activate or focus on the desired little window to make sure the SENDKEYS data is sent to it correctly?

    THANK YOU SOOO MUCH for your help... automating this will be so wonderful if I can get it to work!

    Dave
    Last edited by Aussiebear; 04-12-2025 at 04:31 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •