• Way to fill out a form on a web page using VB? (VB 6)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Way to fill out a form on a web page using VB? (VB 6)

    Author
    Topic
    #364165

    I’d like to be able to fill out a form in a browser (IE 5 or greater) including “text boxes”, “check boxes” and so forth and then have a specific button “clicked” to send the completed form to the web site and I’d like to be able to fill it in via a VB program. I want it to appear to the web site that a user typed in the info when, of course, they didn’t.

    Can anyone tell me if this is possible and if so how I might go about this?

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #558282

      If I understand you question, I think you want to create an IIS application. It’s essentially a VB app that serves web pages. Don’t quote me, but I think you need to mess with VB’s web classes in order to create the IIS application.

      I’d be VB guru Charlotte would know something about this.

      shrug

      • #558291

        I don’t think we’re on the same wavelength…??

        Lets say you’re a remote worker for a company and you’re sitting at your workstation. You’re looking at a form on your company’s website that used for filling in the hours you work. It asks for things like: hours worked, job number, date, etc. and there are other bits of data you need to provide as well.

        You’ve already got all of this info in a database app you wrote for yourself and rather than type in all of the info again you’d like to write a VB program to look at that form in the browser, parse it and then fill it in with the data from your database..

        Is this IIS?

        • #558292

          No, that’s not an IIS program.

          That’s be a client side VB program. If the “remote worker” is running Internet Explorer, then you can automate Internet Explorer and have it plug the correct fields. Of course, if they decide to change the form, then you need to change your program.

          A better solution would be to export your data out of your database in something like XML, send the XML doc to your company, you company would then be able to import your XML to it’s database. No messing with forms. Basically, your taking information from your database and putting it into their database.

          Oh well, gotta go.

          • #558298

            I agree that an XML solution would be best .. BUT that’s not an option – I don’t have control over the “other end” and they are typical corporate types – if you know what I mean..

            How would I go about “automating IE” and “plug the correct fields”? I looked at the browser control offered in VB and don’t see where that could happen. Would this be under the DHTML topic? I’ve been reading the MSDN stuff on DHTML and it seems to be (at this point) to be heading in that direction.

            Thanks for your guidance!

            • #558325

              I wouldn’t give up on the “other end”. I work in an I.S. department for a corporation. Although resources are slim, we are certainly open to ideas. Sometimes there isn’t enough time to do all the cool things the users would like and we need to prioritize.

              Anyway, I just did a search on MSDN for “internet explorer object model”. What I believe you’ll need to do is have VB create an instance of Internet Eplorer, have it surf to the URL that has the form, and then … doh.. I’m not exactly sure at this point. I’m guessing there’s properties and methods that you can invoke to find form fields and place text in those form fields. I’ve automated MS Word, but haven’t touched IE.

              I’d think that you’d want to create your own web page for testing. It’d have a form, then you can experiment as necessary without accidently sending garbage to the other end..

              Here’s a link that looks interesting, but I haven’t read much of it.

              http://msdn.microsoft.com/library/default….accessingie.asp

              Maybe someone else on this forum has some ideas.

              Good luck..

            • #558384

              It depends on what method the site uses to transmit the data (Internally, “get” or “post”). If you send the form, and you see your response somewhere in the url, then you can just simulate the form by creating the url in the same way.

              If you can’t see your data, you might be able to create your own (simplified) copy of the html, probably using asp rather than VB though.

              Or you could try SendKeys, once having navigated to the page.

            • #558545

              Sorry if any of this is too basic for you, don’t mean to be rude:

              If the form isn’t submitted using get (view the source html, you’ll see a line saying form action=”get” or “post”) you can still simulate sending it using xmlHTTP. Look here for details:
              Intro
              http://www.15seconds.com/issue/991125.htm
              vb example:
              http://abstractvb.com/learn.asp?CID=493
              Also
              http://support.microsoft.com/default.aspx?…b;EN-US;q290591

              Hope this helps

              Mark

            • #558689

              Thanks to all for your ideas!

              I thought I’d let you all know where I am after spending the weekend experimenting:

              I managed to cobble together an app that successfully built a portfolio of stocks on the Yahoo site using sendkeys.. Then I went to the actual site that I’m interested in and found that it was MUCH more complicated than the simple Yahoo portfolio I had managed to conquer. The target site is driven by Java and has multiple part forms that have lots of buttons, text boxes, combo boxes, etc. Sorta put a damper on my enthusiasm…

              Then I started going thru a collection of newsletters that I get on a weekly basis from vbwire.com and found a link to a product called WebZinc. Upon first blush it seems as though the author had ME in mind when he/she wrote it! I’m in the investigative stage now and thought I’d let you know about it. It can be found at http://www.webzinc.net.

              If anyone has any experience with this product and would care to share it – I’m all ears!

              I’ll post back to this thread on any progress I may stumble upon.

              Thanks again to all who responded!

            • #558692

              Dingo,

              Just a thought.

              You can use Yahoo to pull stuff from a site- though you do need to need to be able to specify the stock names in the url.

              In Excel 2000, under Data, Get External Data, Run Saved Quesries, there’s a few queries which can retrieve things like stock prices and load them into a spreadsheet.

              I’ve seen a quite comprehensive portfolio manager in Excel which uses this approach.

    Viewing 0 reply threads
    Reply To: Way to fill out a form on a web page using VB? (VB 6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: