Reputation: 11
I'm trying to create an order-tracking macro that does the following after I have selected a specific cell:
I'm working in Excel 2010 off of a sample code I found on another forum. The code accomplishes everything EXCEPT pasting the value of a GIVEN cell. 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 tried using some basic copy paste functions with the active cell. I managed to select and copy the active cell, but not to paste it into the search box.
Here is the code with problem sections identified.
Dim IE As Object
Sub submitFeedback3()
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "TrackingWebsite"
Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
ActiveCell.Select
Selection.Copy
Wend
' **********************************************************************
delay 1
IE.Document.getElementById("receipt").Click
delay 1
IE.Document.getElementById("receipt").Paste
delay 2
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
When I tried copy/paste code, I used the following underneath DoEvents:
ActiveCell.Select
Selection.Copy
Upvotes: 1
Views: 12306
Reputation: 1506
IE.Document.getElementById("appReceiptNum").Click
delay 1
IE.Document.getElementById("appReceiptNum").Paste
works for me, on a different site of course.
If it works for you too, make sure to upvote and click the check mark next to this answer!
Upvotes: 1