Can you guys reading this please try my code and see if it works for you? It isn’t entering a number on my worksheet but it worked for someone else. I have the code in a regular module (not class module, not worksheet module, etc.) in VBA in Excel 2010.
First it should open IE and go to the webpage below. Then the code should enter the number 2688 (or some other 4-digit number) in cell A20 on the Active WorkSheet.
Should prodID be dimmed as an object? And does it need object explicit at the top? or to be in a different type of module? Could something be wrong with my settings? Or why isn’t it working for me?
Sub work_damit()
Dim ieApp As Object
Dim URL As String
Dim prodID As Object
URL = "http://www.craft-e-corner.com/p-2688-new-testament-cricut-cartridge.aspx"
Set ieApp = CreateObject("InternetExplorer.Application")
With ieApp
.Navigate URL
.Visible = True
Label1:
Application.Wait (Now() + TimeValue("0:00:10"))
On Error GoTo errorHandler:
Set prodID = .document.getElementByID("ProductID")
Range("A20").Value = prodID.Value
.Quit
End With
Exit Sub
errorHandler:
If Err.Number <> 462 Then
GoTo Label1:
End If
End Sub
it works perfect for me. What i am thinking is, does your broswer loads with that time period?. if not you might get an error.
Istead of using
use