Results 1 to 7 of 7

Thread: [RESOLVED] Click a Website Button using VB 6

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Resolved [RESOLVED] Click a Website Button using VB 6

    Hi,

    I have a textbox named txtSrch, command button named cmdSrch and a Web Browser Control named wb1 navigated google.com on form load event.

    I want that when i put phrase in txtSrch and click cmdSrch button,
    it should show in the search textbox of google and automatically click on Google's Search Button.

    AIM .....
    1. To show anything written in the VB Text box on the Loaded Web Page.
    2. Click Web Button using VB

    Farooq

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Click a Website Button using VB 6

    Why automate clicking the Google Search button when you can just send your search query directly to Google?

    Code:
    Private Sub cmdSrch_Click()
        wb1.Navigate "http://www.google.com/search?q=" & Replace(txtSrch.Text, " ", "+")
    End Sub
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Click a Website Button using VB 6

    See Google Terms of Service

    Don’t misuse our Services. For example, don’t interfere with our Services or try to access them using a method other than the interface and the instructions that we provide. You may use our Services only as permitted by law, including applicable export and re-export control laws and regulations. We may suspend or stop providing our Services to you if you do not comply with our terms or policies or if we are investigating suspected misconduct.
    What you describe violates these terms of service, which require access by users strictly through a web browser and not another program.

    Doing this can get your entire subnet banned by Google.

    This thread is venturing into prohibited topics.


    Google offers an API for search that applies to some scenarios: Custom Search JSON/Atom API. This may have a charge associated with use depending on what you use it for.
    Last edited by dilettante; Mar 27th, 2014 at 10:22 AM.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Re: Click a Website Button using VB 6

    Using google is only for example.
    Want to know how to click the web button using vb6

  5. #5
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Click a Website Button using VB 6

    If Google is only an example then is Google's Search Button also only an example? If so, then how can we know exactly what button you want to click on if, let's say, you are not using Google as the target Website.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: Click a Website Button using VB 6

    IE.Document.Button.Click

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    Quetta-Pakistan
    Posts
    852

    Re: Click a Website Button using VB 6

    I got a code from a site
    Code:
        For I = 0 To Wb1.Document.Forms(0).length - 1
        
          If Wb1.Document.Forms(0)(I).Type = "submit" Then
            Wb1.Document.Forms(0)(I).Click
            Exit For
          End If
            
        Next I
    Thanks for help.

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