Hi guys
I had this code working in a blank workbook
i then put it straght into another workbook and now whenever i run it it comes up with an error message saying:
Compile error:
User-Defined type not defined
i dont think i did anything different
i also copied it into a new blank workbook and it dosent work either.
still works in the original sheet though.
Public Sub LaunchJaguar() Const strURL_c As String = "https://jaguarlandrover.leapfile.net/fts/drop/jlr/portal/Login.jsp" Const strUsr_c As String = "[email protected]" Const strPwd_c As String = "xxxxxxx" Dim objIE As SHDocVw.InternetExplorer Dim ieDoc As MSHTML.HTMLDocument Dim tbxPwdFld As MSHTML.HTMLInputElement Dim tbxUsrFld As MSHTML.HTMLInputElement Dim btnSubmit As MSHTML.HTMLInputButtonElement ' On Error GoTo Err_Hnd 'Create Internet Explorer Object Set objIE = New SHDocVw.InternetExplorer 'Navigate the URL objIE.navigate strURL_c 'Wait for page to load Do Until objIE.readyState = READYSTATE_COMPLETE: Loop 'Get document object Set ieDoc = objIE.document 'Get username/password fields and submit button. Set tbxPwdFld = ieDoc.all.Item("password") 'name of the username textbox Set tbxUsrFld = ieDoc.all.Item("email") 'name of the password textbox Set btnSubmit = ieDoc.all.Item("signIn") 'name of the submit button on the form 'Fill Fields tbxUsrFld.Value = strUsr_c tbxPwdFld.Value = strPwd_c 'Click submit btnSubmit.Click objIE.Visible = True objIE.navigate "https://jaguarlandrover.leapfile.net/fts/drop/jlr/portal/Downloads.jsp" 'Wait for page to load Do Until objIE.readyState = READYSTATE_COMPLETE: Loop Err_Hnd: '(Fail gracefully) End Sub
Bookmarks