Thursday, 12 September 2013

Pasting into web form from selected cell only

Pasting into web form from selected cell only

Total newbie here with what is (probably) a super easy question. I'm
working off of a sample code I found on another forum and have hit a wall.
What I'm trying to do is create an order-tracking macro that does the
following after I have selected a specific cell:
Opens the order-tracking webpage (eg. FedEx)
Enters the value of the cell into the appropriate search box
Clicks submit
I'm using the following code which accomplishes everything EXCEPT pasting
the value of a GIVEN cell. In other words, I can assign a numerical value
or specific cell value to be entered, but I need a universal macro that I
can use for any given cell.
I've tried using some basic copy paste functions with the active cell.
I've managed to get it to select and copy the active cell, but not to
paste it into the search box. This is the point where, to an expert, I'd
imagine that I start looking like an idiot. Again, I'm a complete newbie
so please forgive me!
Here is the code with problem sections identified. Thanks in advance for
the help!
Dim IE As Object
Sub submitFeedback3()
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "OrderTrackingWebsite"
Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
Wend
' **********************************************************************
delay 3
IE.Document.getElementById("appReceiptNum").**Value =**
delay 3
IE.Document.getElementById("submit").Click
'**********************************************************************
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

No comments:

Post a Comment