jmarvin_18
New Member
- Joined
- Jun 27, 2017
- Messages
- 6
Hi,
I'm trying to integrate our Excel Tool to our customer information database to quickly search for information. I was able to control some of the hyperlinks and button I just want to ask some help on how I can auto fill the the input Search Box in the website that we're using in our office.
Sub crm()
'On Error Resume Next
Dim MyHTML_Element As IHTMLElement
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInputs As MSHTML.IHTMLElementCollection
Dim HTMLInput As IHTMLElement
Dim elements As MSHTML.IHTMLElementCollection
IE.navigate "10.163.74.252/ProView/main.aspx#"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = 4
Set HTMLDoc = IE.document
Set Allhyperlinks = IE.document.getElementsByTagName("nobr")
For Each hyper_link In Allhyperlinks
If hyper_link.innerText = "Provider" Then
hyper_link.Click
Exit For
End If
Next
Do
DoEvents
Loop Until IE.readyState = 4
Set aAllhyperlinks = IE.document.getElementsByTagName("A")
For Each hyper_link In aAllhyperlinks
If hyper_link.innerText = "Contacts" Then
hyper_link.Click
Exit For
End If
Next
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
Set HTMLInput = HTMLDoc.getElementById("crmGrid_findCriteria")
HTMLInput.Value = "12546892"
End Sub
HTML Code
________________________________________________________________________________________________
<table width="100%" title="Use asterisk (*) wildcard character to search on partial text" cellspacing="0" cellpadding="0"><tbody>
<tr id="crmGrid_quickFindContainer" gridid="crmGrid">
<td valign="top" style="width: 100%; overflow: hidden;"><div style="position: relative;">
<label class="ms-crm-Dialog-Lookup-QuickFindHint ms-crm-TextAutoEllipsis" id="crmGrid_findHintText" style="display: inline;" for="crmGrid_findCriteria">Search for records</label>
</div>
<div style="height: 100%;">
<input tabindex="0" class="ms-crm-Dialog-Lookup-QuickFind" id="crmGrid_findCriteria" type="text" maxlength="100" hintlabelid="crmGrid_findHintText" value="" >
</div>
</td>
<td class="AppQuickFind_Render_td" nowrap="">
<a tabindex="0" class="ms-crm-FindButton" id="crmGrid_findCriteriaButton" href="#" target="_self">
<img title="Start search" class="ms-crm-ImageStrip-search " id="crmGrid_findCriteriaImg" alt="Start search" src="/_imgs/imagestrips/transparent_spacer.gif?ver=-1172914485" imgbase="/_imgs/search"></a>
<a tabindex="0" class="ms-crm-FindButton" id="crmGrid_clearCriteriaButton" style="display: none;" href="#" target="_self">
<img title="Clear search" id="crmGrid_clearCriteriaImg" alt="Clear search" src="/_imgs/searchclear.gif" imgbase="/_imgs/searchclear">
</a>
</td>
</tr>
</tbody>
</table>
I'm trying to integrate our Excel Tool to our customer information database to quickly search for information. I was able to control some of the hyperlinks and button I just want to ask some help on how I can auto fill the the input Search Box in the website that we're using in our office.
Sub crm()
'On Error Resume Next
Dim MyHTML_Element As IHTMLElement
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInputs As MSHTML.IHTMLElementCollection
Dim HTMLInput As IHTMLElement
Dim elements As MSHTML.IHTMLElementCollection
IE.navigate "10.163.74.252/ProView/main.aspx#"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = 4
Set HTMLDoc = IE.document
Set Allhyperlinks = IE.document.getElementsByTagName("nobr")
For Each hyper_link In Allhyperlinks
If hyper_link.innerText = "Provider" Then
hyper_link.Click
Exit For
End If
Next
Do
DoEvents
Loop Until IE.readyState = 4
Set aAllhyperlinks = IE.document.getElementsByTagName("A")
For Each hyper_link In aAllhyperlinks
If hyper_link.innerText = "Contacts" Then
hyper_link.Click
Exit For
End If
Next
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
Set HTMLInput = HTMLDoc.getElementById("crmGrid_findCriteria")
HTMLInput.Value = "12546892"
End Sub
HTML Code
________________________________________________________________________________________________
<table width="100%" title="Use asterisk (*) wildcard character to search on partial text" cellspacing="0" cellpadding="0"><tbody>
<tr id="crmGrid_quickFindContainer" gridid="crmGrid">
<td valign="top" style="width: 100%; overflow: hidden;"><div style="position: relative;">
<label class="ms-crm-Dialog-Lookup-QuickFindHint ms-crm-TextAutoEllipsis" id="crmGrid_findHintText" style="display: inline;" for="crmGrid_findCriteria">Search for records</label>
</div>
<div style="height: 100%;">
<input tabindex="0" class="ms-crm-Dialog-Lookup-QuickFind" id="crmGrid_findCriteria" type="text" maxlength="100" hintlabelid="crmGrid_findHintText" value="" >
</div>
</td>
<td class="AppQuickFind_Render_td" nowrap="">
<a tabindex="0" class="ms-crm-FindButton" id="crmGrid_findCriteriaButton" href="#" target="_self">
<img title="Start search" class="ms-crm-ImageStrip-search " id="crmGrid_findCriteriaImg" alt="Start search" src="/_imgs/imagestrips/transparent_spacer.gif?ver=-1172914485" imgbase="/_imgs/search"></a>
<a tabindex="0" class="ms-crm-FindButton" id="crmGrid_clearCriteriaButton" style="display: none;" href="#" target="_self">
<img title="Clear search" id="crmGrid_clearCriteriaImg" alt="Clear search" src="/_imgs/searchclear.gif" imgbase="/_imgs/searchclear">
</a>
</td>
</tr>
</tbody>
</table>