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:
Do you have any ideas what might help so macro wouldn't lose data? Or maybe there's another way of performing this task?
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?