INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

auto fill webform and submit and loop from xls sheet

auto fill webform and submit and loop from xls sheet

(OP)
I have been working on this for a bit here is what I have any help would be greatly apprieciated.

Sub submitFeedback3()
Application.ScreenUpdating = False

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://www.livingoffthenet.com/sfaulkner/"

Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
Wend
' **********************************************************************
IE.Document.All("fname").Value = ThisWorkbook.Sheets("Leads").Range("a1:a1000")
IE.Document.All("email").Value = ThisWorkbook.Sheets("Leads").Range("b1:b1000")
IE.Document.getElementById onclick = "sendForm"
'**********************************************************************
Application.StatusBar = "Form Submitted"
IE.Quit
Set IE = Nothing

Application.ScreenUpdating = True
End Sub

Private Sub delay(seconds As Long)
Dim endTime As Date
endTime = DateAdd("s", seconds, Now())
Do While Now() < endTime
DoEvents
Loop
End Sub

RE: auto fill webform and submit and loop from xls sheet

Steve,

Please be sure to delete your other duplicate thread.

CODE

'
    Dim r As Range
    
    For Each r In ThisWorkbook.Sheets("Leads").Range("a1:a1000")
        IE.Document.All("fname").Value = r.Value
        IE.Document.All("email").Value = r.Offset(0, 1).Value
        IE.Document.getElementById onclick = "sendForm"
    Next 

Just curious...
Why don't you have HEADINGS for your table? FAQ68-5184: What are LIST & TABLE PRINCIPLES for Spreadsheet Users

Furthermore, If you have Excel version 2007 or greater, the Structured Table feature is really quite remarkable. Let's say that your headings are User Name & eMail Address. With a Structured Table...

CODE

'
    Dim r As Range
    
    For Each r In [Table1[User Name]]
        IE.Document.All("fname").Value = r.Value
        IE.Document.All("email").Value = Intersect(r.EntireRow, [Table1[eMail Address]]).Value
        IE.Document.getElementById onclick = "sendForm"
    Next 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: auto fill webform and submit and loop from xls sheet

(OP)
Thanks it worked all accept the submit part I have something wrong still. To answer your question I'm pretty green to programing just trying to learn...

RE: auto fill webform and submit and loop from xls sheet

(OP)
Skip How do I get this submit and reload the page When I run it I see all the data flying through but its not being submitted Thanks again for your help.

RE: auto fill webform and submit and loop from xls sheet

I know nothing about IE properties and methods.

But something like this might work. I forgot to add it originally...

CODE

'
    Dim r As Range
    
    For Each r In ThisWorkbook.Sheets("Leads").Range("a1:a1000")
        IE.Document.All("fname").Value = r.Value
        IE.Document.All("email").Value = r.Offset(0, 1).Value
        IE.Document.getElementById onclick = "sendForm"
        While IE.Busy
            DoEvents
        Wend
    Next 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: auto fill webform and submit and loop from xls sheet

(OP)
That might work but this line doesn't fail but it doesn't submit or it might have worked.
IE.Document.getElementById onclick = "sendForm"
is having issues submitting. I think I'm closer though.. Do you know of an IE.form code?


RE: auto fill webform and submit and loop from xls sheet

(OP)
Skip,

Thank You for all your help i do appreciate it. I did finally get the code to work and wanted to share it with you. not sure if there is a better way or not but this works.

Sub submitFeedback3()
Application.ScreenUpdating = False

Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.livingoffthenet.com/sfaulkner/"
IE.Visible = True

Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
Wend

Dim r As Range

For Each r In ThisWorkbook.Sheets("Leads").Range("a1:a1000")
IE.Document.All("fname").Value = r.Value
IE.Document.All("email").Value = r.Offset(0, 1).Value
IE.Document.getElementById("formbutton").onclick

While IE.Busy
DoEvents
Wend
IE.Quit
Application.StatusBar = "Form Submitted"
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.livingoffthenet.com/sfaulkner/"
IE.Visible = True

Next
End Sub

RE: auto fill webform and submit and loop from xls sheet

Glad you got it working and posted your solution for the benefit of others.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close