You're already using
VB(A) and automation, so just ditch the sendkeys and
use the HTML document object model instead.
If the webmaster changes the basic site design/layout it *will* break your
code, whatever approach you use.
Tim
"DW" wrote in message
...
Thanks alex and Tim, but this is not anything that needs C or VB. The
spreadsheet just has a list of #'s that need to be sent to a web page so
information can then be viewed on that web page. Just something to
eliminate a lot of cutting and pasting.
In the past (XL 2003), I used (for this project) sendkeys commands and
they worked great. Now, with 2007 (XL 2007 Standard), they do not always
hit the fields on the web page (or at least do not seem to). Here's what
I've been using so far (userid's and passwords changed to protect the
innocent :) ). What I'd like to be able to do, is change this to something
better, in the event the webmaster changes the site, AND even tho this
runs quick, so the user can do something else besides twiddle their
thumbs.
Thanks,
Don
Spreadsheet List Example:
27278
28234
29362
29379
29550
29552
29554
29556
30091
30094
Code:
Sub tabIE()
Dim objIE As Object
Dim response As String
Dim msg As String
msg = "How many items are you checking?"
response = InputBox(msg)
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.navigate
"https://www.smcorp.com/weborder/smc_stockchk.asp?mscssid=22895545+++++++++++++++++ +++++++"
.resizable = True
End With
Application.Wait (Now + TimeValue("0:00:30"))
SendKeys "USERID"
SendKeys "{TAB}"
SendKeys "PASSWORD"
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "~"
Application.Wait (Now + TimeValue("0:00:05"))
Call tabIE2(response)
ActiveWorkbook.Save
Set objIE = Nothing
End Sub
Sub tabIE2(response As String)
Dim msg As String
SendKeys response
SendKeys "~"
Application.Wait (Now + TimeValue("0:00:03"))
For k = 1 To 10
SendKeys "{TAB}"
Next k
Application.Wait (Now + TimeValue("0:00:01"))
For j = 1 To 17
SendKeys "{TAB}"
Next j
Application.Wait (Now + TimeValue("0:00:01"))
For i = 0 To response
SendKeys ActiveCell.Value
SendKeys "{TAB}"
Application.Wait (Now + TimeValue("0:00:01"))
If i = 0 Then
Selection.Font.ColorIndex = 3
Else
If i = response Then
ActiveCell.Cells(1, 2).Activate
msg = "Left off here"
ActiveCell.FormulaR1C1 = msg
ActiveCell.Cells(1, -1).Activate
End If
End If
ActiveCell.Cells(2, 1).Select
Next i
Application.Wait (Now + TimeValue("0:00:01"))
SendKeys "~"
End Sub
"alex" wrote in message
oups.com...
On Apr 9, 11:10 pm, "DW" wrote:
I'm trying to send data from an excel (2007) spreadsheet to an IE (6)web
form.
Can someone suggest the best method possible?
I've tried sendkeys, and it only works sometimes.
Thanks,
Don
You can try SWExplorerAutomation (SWEA) from http://webiussoft.com.
SWEA is very reliable, fast IE automation framework. SWEA records
automation scripts and generates C# or VB.NET code.