Results 1 to 3 of 3

Thread: [RESOLVED] f.submit not working for website

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    11

    Resolved [RESOLVED] f.submit not working for website

    The very basic code below populates the trainline form online. When I come to submit the form, the page just refreshes itself. If I omit the f.submit command and press the online button myself it works. Is there another option for submitting or do i have the wrong command? Any advice or help appreciated.

    Code:
    Sub get_times_test()
    
       Set web = CreateObject("InternetExplorer.Application")
       web.Navigate2 "http://www.thetrainline.com/buytickets/?href=&T2ID=8507_20078301696"
       web.Visible = True
       
       Do Until web.ReadyState = 4
        DoEvents
       Loop
       
       Set f = web.Document.forms(0)
       
       f("OriginStation").Value = "LDS"
       f("DestinationStation").Value = "MAN"
       f("outwardDate").Value = "20/12/09"
       f("OpenReturnJourneyCheckBox").Checked = True
       f.submit
    
    End Sub

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: f.submit not working for website

    try
    f("extendedSearch").click
    as there is more than one submit button, hard to know which is submitted
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    11

    Re: [RESOLVED] f.submit not working for website

    Brilliant. Thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width