I am getting an error of "object variable or with block variable not set" when this macro runs. The highlighted line to debug is the 2nd one from the bottom - "estimate.Click". When I hover the mouse over "Set estimate" on the next line up, it says "estimate=Nothing". "estimate.submit" acts the same way. The corresponding button on the webpage is never clicked. All the rest of this code is working well.
Sub btn_version()
Dim ieApp As Object
Dim ieDoc As Object
Dim ieForm As Object
Dim ieObj As Object
Dim URL As String
Dim estimate As Object
URL = "http://www.craft-e-corner.com/p-2688-new-testament-cricut-cartridge.aspx"
Set ieApp = CreateObject("InternetExplorer.Application")
ieApp.Visible = True
ieApp.navigate URL
While ieApp.Busy Or ieApp.readyState <> 4: DoEvents: Wend
Set ieDoc = ieApp.document
Set ieForm = ieDoc.forms(1)
For Each ieObj In ieForm.Elements
If ieObj.ClassName = "AddToCartButton" Then
ieObj.Click
End If
Next ieObj
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
While ieApp.Busy Or ieApp.readyState <> 4: DoEvents: Wend
Set estimate = ieApp.document.getElementById("btnRequestEstimates")
estimate.Click
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub