update a web form

BrianO

New Member
Joined
Mar 13, 2009
Messages
47
Hey Everyone

I am trying to use an existing webform to lookup and then update a record.
The first thing I have done is opened the search page and populated the text box and submit the form.
This then load the page with the record details which are presented in a prepopulated webform. It works to this point.

What I am looking to do is update the webform with data from a worksheet.

This is my code so far.

Rich (BB code):
Private Sub CommandButton2_Click()
Dim referral As String
Dim refbrand As String
Dim ie As Object
 
refbrand = Worksheets("sheet2").Range("D4").Value       'dropdown
referral = Worksheets("sheet2").Range("C3").Value
 
 Set ie = CreateObject("InternetExplorer.Application")
   With ie
        .Visible = True
        .Navigate "http://www.example.com"
        Do Until .ReadyState = 4: DoEvents: Loop
 
   End With
 
   Set RefID = ie.Document.all.Item("referral")
 
    RefID.Value = referral
 
    ie.Document.forms(0).submit
 
 
 
  '===============Populate form
 
 
           Set brand = ie.Document.all.Item("refbrand")
 
 
 
            brand.Value = refbrand
 
 
 
' Do While ie.ReadyState <> 4: DoEvents: Loop
'   Do While ie.Busy: DoEvents: Loop
 '============END POpulate form
 
 
End Sub

I have read a number of posts but still haven't figured this out.
Any help would be appreciated.

Brian
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Ok I have figured this one out.

It needed the following line

Code:
Do Until ie.Document.ReadyState = "complete": DoEvents: Loop

after the submit to give ie time to load the next page. then it can continue to populate.

Brian
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top