Let me start by saying that my programming skills are novice at best. However, I am attempting to write a sub routine to login to a website and enter data from a spreadsheet into a search field on the site. Logging in requires navigation through a series of three pages. I have successfully navigated through the first two. The problem is that on the third page when I attempt to reference an IE form called ByKeywords I get a "Run Time Error - 438 Object doesn't support this property or method". I've been stuck on this for a couple days and have searched every forum I could find.
Sub LoginToEsales()
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.Navigate "My Website (unable to post link due to privacy concerns)"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
With ieDoc.loginform
.operinit.Value = "gmbg"
.passWord.Value = "gmbg"
.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
With ieDoc.choosecust
.setcustno.Value = "240"
.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
With ieDoc.ByKeywords 'This is where I get the Runtime Error - 438
.keywords.Value = "gmbg"
'.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
UserForm1.Hide
End Sub
Here is the html code for the page I am trying to access:
<TABLE>
<TBODY>
<TR>
<TD>
<TABLE class=maintab border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=tabtitle>Find Products by Keyword </TD>
<TR class=wfill>
<TD colSpan=2 align=center>
<TABLE>
<TBODY>
<TR>
<TD align=center>
<DIV class=screenmsg>Note: Single department order entry!!!<BR>User can enter items to be charged to one department at a time. </DIV></TD></TR></TBODY></TABLE></TD>
<TD class=border><IMG src="/WI_web/Images/border.gif" width=2 height=1></TD></TR><!-- TB x155 removed the escape from the onSubmit -->
<FORM onsubmit="this.key.value = this.keywords.value; return true" method=get name=ByKeyword action=inquire-prod.r><INPUT name=sessid value=0x05988b17 type=hidden> <INPUT name=method value=keyword type=hidden> <INPUT name=file value=ICSP type=hidden> <INPUT name=searchby value=keyword type=hidden> <INPUT name=forward value=yes type=hidden> <INPUT name=lastrowid type=hidden> <INPUT name=key type=hidden>
<TR class=wfill>
<TD vAlign=top>
<TABLE class=1subtab border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=label>Keywords: </TD>
<TD class=field><INPUT onfocus='SelectText(this, "Enter any keywords (Optional)")' name=keywords maxLength=60 size=30> </TD></TR>
<TR>
<TD class=label>Warehouse: </TD>
<TD class=field><SELECT onfocus='Help("Select warehouse or use default")' name=whse> <OPTION selected value=BGCS>GM Bowling Green - HSS(BGCS)<OPTION value=2038>POU 1(2038)<OPTION value=2039>POU 2(2039)<OPTION value=2040>POU 4(2040)<OPTION value=2041>POU 6(2041)<OPTION value=2042>POU 7(2042)<OPTION value=2043>POU 8(2043)<OPTION value=2044>POU 9(2044)<OPTION value=2045>POU 10(2045)<OPTION value=2046>POU 11(2046)<OPTION value=2047>POU 12(2047)<OPTION value=2048>POU 13(2048)<OPTION value=2049>POU 15(2049)<OPTION value=2050>POU 16(2050)<OPTION value=2051>POU 17(2051)<OPTION value=2052>POU 19(2052)<OPTION value=2053>POU 20(2053)<OPTION value=2054>POU 22(2054)<OPTION value=2055>POU 23(2055)<OPTION value=2076>POU 24(2076)<OPTION value=2083>POU 25(2083)<OPTION value=2084>POU 26(2084)<OPTION value=2085>POU 27(2085)<OPTION value=3000>COVERS PRIME-1 2 CART(3000)<OPTION value=3001>PRIME-1 2 CART(3001)<OPTION value=3002>COVERS 1STCOLOR-1 2 CART(3002)<OPTION value=3003>1STCOLOR-1 2 CART(3003)<OPTION value=3004>COVERS 3RDCOLOR-1 2 CART(3004)<OPTION value=3005>3RDCOLOR-1 2 CART(3005)<OPTION value=3006>COVERS FASCIA-1 2 CART(3006)<OPTION value=3007>FASCIA-1 2 CART(3007)<OPTION value=3008>ROBOT ATTNDS-1 2 CART(3008)<OPTION value=3009>PAINT MIX-1 2 CART(3009)<OPTION value=BGWR>GMBG Warranty Repair Warehouse(BGWR)<OPTION value=BILL>HSS LLC(BILL)</OPTION></SELECT> </TD></TR></TBODY></TABLE></TD>
<TD vAlign=top>
<TABLE class=1subtab border=0 cellSpacing=0 cellPadding=2>
<TBODY>
<TR>
<TR class=colhead>
<TD class=headcell vAlign=middle colSpan=2 align=center><INPUT onfocus='Help("Click to search for products by keywords")' name=submit
<TR class=wfill>
<TD class=headcell colSpan=2 align=center><A href="get-cart-lines.r?sessid=0x05988b17&forward=yes&lastrowid="><IMG border=0 src="/WI_web/Images/cart.gif"></A><BR>
<TABLE>
<TBODY>
<TR>
<TD align=center>
<DIV class=screenmsg>Click cart button when finished entering products for a department. </DIV></TD></TR></TBODY></TABLE></TD>
<TR>
<TR>
></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><!-- Generated by Webspeed: Progress Communities: Clearspace: Progress Communities -->
Sub LoginToEsales()
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Dim ieTable As Object
Set ieApp = New InternetExplorer
ieApp.Visible = True
ieApp.Navigate "My Website (unable to post link due to privacy concerns)"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.Document
With ieDoc.loginform
.operinit.Value = "gmbg"
.passWord.Value = "gmbg"
.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
With ieDoc.choosecust
.setcustno.Value = "240"
.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
With ieDoc.ByKeywords 'This is where I get the Runtime Error - 438
.keywords.Value = "gmbg"
'.submit
End With
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
UserForm1.Hide
End Sub
Here is the html code for the page I am trying to access:
<TABLE>
<TBODY>
<TR>
<TD>
<TABLE class=maintab border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=tabtitle>Find Products by Keyword </TD>
<TR class=wfill>
<TD colSpan=2 align=center>
<TABLE>
<TBODY>
<TR>
<TD align=center>
<DIV class=screenmsg>Note: Single department order entry!!!<BR>User can enter items to be charged to one department at a time. </DIV></TD></TR></TBODY></TABLE></TD>
<TD class=border><IMG src="/WI_web/Images/border.gif" width=2 height=1></TD></TR><!-- TB x155 removed the escape from the onSubmit -->
<FORM onsubmit="this.key.value = this.keywords.value; return true" method=get name=ByKeyword action=inquire-prod.r><INPUT name=sessid value=0x05988b17 type=hidden> <INPUT name=method value=keyword type=hidden> <INPUT name=file value=ICSP type=hidden> <INPUT name=searchby value=keyword type=hidden> <INPUT name=forward value=yes type=hidden> <INPUT name=lastrowid type=hidden> <INPUT name=key type=hidden>
<TR class=wfill>
<TD vAlign=top>
<TABLE class=1subtab border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=label>Keywords: </TD>
<TD class=field><INPUT onfocus='SelectText(this, "Enter any keywords (Optional)")' name=keywords maxLength=60 size=30> </TD></TR>
<TR>
<TD class=label>Warehouse: </TD>
<TD class=field><SELECT onfocus='Help("Select warehouse or use default")' name=whse> <OPTION selected value=BGCS>GM Bowling Green - HSS(BGCS)<OPTION value=2038>POU 1(2038)<OPTION value=2039>POU 2(2039)<OPTION value=2040>POU 4(2040)<OPTION value=2041>POU 6(2041)<OPTION value=2042>POU 7(2042)<OPTION value=2043>POU 8(2043)<OPTION value=2044>POU 9(2044)<OPTION value=2045>POU 10(2045)<OPTION value=2046>POU 11(2046)<OPTION value=2047>POU 12(2047)<OPTION value=2048>POU 13(2048)<OPTION value=2049>POU 15(2049)<OPTION value=2050>POU 16(2050)<OPTION value=2051>POU 17(2051)<OPTION value=2052>POU 19(2052)<OPTION value=2053>POU 20(2053)<OPTION value=2054>POU 22(2054)<OPTION value=2055>POU 23(2055)<OPTION value=2076>POU 24(2076)<OPTION value=2083>POU 25(2083)<OPTION value=2084>POU 26(2084)<OPTION value=2085>POU 27(2085)<OPTION value=3000>COVERS PRIME-1 2 CART(3000)<OPTION value=3001>PRIME-1 2 CART(3001)<OPTION value=3002>COVERS 1STCOLOR-1 2 CART(3002)<OPTION value=3003>1STCOLOR-1 2 CART(3003)<OPTION value=3004>COVERS 3RDCOLOR-1 2 CART(3004)<OPTION value=3005>3RDCOLOR-1 2 CART(3005)<OPTION value=3006>COVERS FASCIA-1 2 CART(3006)<OPTION value=3007>FASCIA-1 2 CART(3007)<OPTION value=3008>ROBOT ATTNDS-1 2 CART(3008)<OPTION value=3009>PAINT MIX-1 2 CART(3009)<OPTION value=BGWR>GMBG Warranty Repair Warehouse(BGWR)<OPTION value=BILL>HSS LLC(BILL)</OPTION></SELECT> </TD></TR></TBODY></TABLE></TD>
<TD vAlign=top>
<TABLE class=1subtab border=0 cellSpacing=0 cellPadding=2>
<TBODY>
<TR>
<TR class=colhead>
<TD class=headcell vAlign=middle colSpan=2 align=center><INPUT onfocus='Help("Click to search for products by keywords")' name=submit
<TR class=wfill>
<TD class=headcell colSpan=2 align=center><A href="get-cart-lines.r?sessid=0x05988b17&forward=yes&lastrowid="><IMG border=0 src="/WI_web/Images/cart.gif"></A><BR>
<TABLE>
<TBODY>
<TR>
<TD align=center>
<DIV class=screenmsg>Click cart button when finished entering products for a department. </DIV></TD></TR></TBODY></TABLE></TD>
<TR>
<TR>
></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><!-- Generated by Webspeed: Progress Communities: Clearspace: Progress Communities -->