Copying data into IE form

jozi86

New Member
Joined
May 4, 2011
Messages
20
Hi,

I am new quite new to VBA and I am working on the macro that would fill form in Internet Explorer. I want my macro to take value from each cell in a range and copy it into a field in a form. As it is an easy form I tried to use SendKeys (yes, I know I should avoid it when possible) but it didn't work well for me. Macro sometimes skips some fields, sometimes it skips two fields and sometimes it gives good results for 5 or 10 fields in a row. I thought a problemy might be caused by to quick switching from IE to Excel so I added Application.Wait instruction but id didn't work...

The code I'm having right now is:
Code:
Sub MoveData() 
Dim rData As Range 
Dim rAll As Range '

Set rAll = Range("A1", Range("A1").End(xlDown)) 

    For Each rData In rAll
    rData.Copy 
    AppActivate ("Internet Explorer") 
    Application.Wait (Now + TimeSerial(0, 0, 1)) 
    SendKeys "^v", True 
    Application.Wait (Now + TimeSerial(0, 0, 1)) 
    SendKeys "{TAB}", True 
    Application.Wait (Now + TimeSerial(0, 0, 1)) 
    AppActivate "Microsoft Excel" 
    Application.Wait (Now + TimeSerial(0, 0, 1)) 
    Next rData
    
End Sub

Do you have any ideas what might help so macro wouldn't lose data? Or maybe there's another way of performing this task?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Untested, but try replacing the Application.Wait lines with DoEvents.
 
Upvote 0
I'll check it - Thank you. I don't have an access to IE form at home but as soon as I check it - I will let you know.
 
Upvote 0
Hi,
Unfortunately it didn't work. Macro still skips fields in a form. Do you have any other ideas?
 
Upvote 0
If this is a form on a webpage then if you post the URL then I'm sure someone can help.
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

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