shinigami_tianshi
New Member
- Joined
- Jun 11, 2018
- Messages
- 7
Hi everyone
Currently I have a list of ID numbers in excel and wish to extract info from intranet. Prior to extract the data, I encountered error message when macro attempted to "click" the "Search" button in the webpage after have key in the ID number in the intranet fields.
The error message was : Run time error 91 Object variable or with block variable not set
Appears during the macro line : ie.Document.getElementById("search").Value.Click
Macro Code:
private Sub wpieautologin()
Dim ie As Object
Set ie = New SHDocVw.InternetExplorer
Set ie = CreateObject("Internetexplorer.Application")
ie.Navigate "intranet.com"
ie.Visible = True
Do
DoEvents
Loop Until ie.ReadyState = 4
ie.Document.getElementById("policyCode_text").Click
ie.Document.getElementById("policyCode_text").Value = "0026954693"
ie.Document.getElementById("search").Value.Click
End Sub
The following in the view source code for the intranet page on the "Search" button:
<td height="25" align="center" ><input value="Search" *******="if(checkNotNull()){transSubmitValue();}else {return false;}" class="button" type="submit" >
<input value="Exit" *******="if(checkNotNull()){transSubmitValue();javascript:goHome();return false;}else {return false;}" class="button" type="button" ></td>
Sincerely appreciate for help !
YH
Currently I have a list of ID numbers in excel and wish to extract info from intranet. Prior to extract the data, I encountered error message when macro attempted to "click" the "Search" button in the webpage after have key in the ID number in the intranet fields.
The error message was : Run time error 91 Object variable or with block variable not set
Appears during the macro line : ie.Document.getElementById("search").Value.Click
Macro Code:
private Sub wpieautologin()
Dim ie As Object
Set ie = New SHDocVw.InternetExplorer
Set ie = CreateObject("Internetexplorer.Application")
ie.Navigate "intranet.com"
ie.Visible = True
Do
DoEvents
Loop Until ie.ReadyState = 4
ie.Document.getElementById("policyCode_text").Click
ie.Document.getElementById("policyCode_text").Value = "0026954693"
ie.Document.getElementById("search").Value.Click
End Sub
The following in the view source code for the intranet page on the "Search" button:
<td height="25" align="center" ><input value="Search" *******="if(checkNotNull()){transSubmitValue();}else {return false;}" class="button" type="submit" >
<input value="Exit" *******="if(checkNotNull()){transSubmitValue();javascript:goHome();return false;}else {return false;}" class="button" type="button" ></td>
Sincerely appreciate for help !
YH