Results 1 to 8 of 8

Thread: Automatically fill out IE form fields?

  1. #1
    steven m
    Guest

    Question Automatically fill out IE form fields?

    Hi.
    I need a code sniplet that will automaticallyu insert text into form fields in a browser window (I don't care if it's a browser opened outside the application, or a BrowserControl object in the program, either works for me). You click a button in the program, and the program would fill out the form that is n the page in teh browser. How can this be done? Your help is really appreciated.

  2. #2
    CMangano
    Guest
    Not sure this is what you are looking for, but if you do:

    <input type="text" name="myfield" value="This text will appear"> Then the user will see "This text will appear" in the textfield. Now, how you get that text is up to you.

    Again, not sure if that is what you mean.

  3. #3
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    You can use the webbrowser control and use a loop with something like this:

    Code:
    For r = 0 To webbrowser.Document.Forms(Form).length - 1
       If webbrowser.Document.Forms(form)(r).Name = "q" Then
          webbrowser.Document.Forms(form)(r).Value = "Whatever"
       End If
    Next

  4. #4
    steven m
    Guest

    Ehh...

    Hi.
    Thanks. It works for ask.com and stuff, but on some sites it tells me:
    Run-time error '91' Object bariable or With variable not set.
    How do I get around this? Thanks.

  5. #5
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    To be honest with you, I am not all that familiar with this, I have only used it a couple times and can't find any documentation on it. I think the problem you are experiencing, and I have too, is when there is more that one form on a page. Sorry I couldn't be of more help, I would just try playing around with it a little further.

  6. #6
    steven m
    Guest
    Anyways, thanks for your trouble. The pages that give me error messages only appear to have one form on them. However, I always get the error when I try to fill out a form in a document that contains more than one frame. I think that's the problem. I played with it for nearly 3 hours, but I was unable to get it to work. Would there be a way to fix this error? Or maybe there's a way to fill out fields in an alredy-open IE window? (I don't care weather it's a window or a WebBrowser object, just as long as it works). Maybe you could direct me to a resource which would help me? Any help would be appreciated.

  7. #7
    Frenzied Member seoptimizer2001's Avatar
    Join Date
    Apr 2001
    Location
    Toledo, Ohio USA GMT -5
    Posts
    1,075
    You could always use SendKeys and Tab through the page

  8. #8
    steven m
    Guest
    Thank you. That's probably what I'll do.

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