I need to pull the text 'Catalog Manager/ Sales' & 'EOL (product/component)' from the view source tab using VBA.
Below is the view source code:
<tr>
<td nowrap="true" valign="top" width="165px" class="ms-formlabel"><h3 class="ms-standardheader"><a name="SPBookmark_Requesting_x0020_Group"></a>Requesting Group</h3></td>
<td valign="top" class="ms-formbody" width="450px" id="SPFieldChoice">
<!-- FieldName="Requesting Group"
FieldInternalName="Requesting_x0020_Group"
FieldType="SPFieldChoice"
-->
Catalog Managers/ Sales
</td>
</tr>
<tr>
<td nowrap="true" valign="top" width="165px" class="ms-formlabel"><h3 class="ms-standardheader"><a name="SPBookmark_Reason_x0020_for_x0020_change"></a>Reason for change</h3></td>
<td valign="top" class="ms-formbody" width="450px" id="SPFieldChoice">
<!-- FieldName="Reason for change"
FieldInternalName="Reason_x0020_for_x0020_change"
FieldType="SPFieldChoice"
-->
EOL (product/component)
</td>
</tr>
There are multiple id="SPFieldChoice"
and i need to pull the details only for 'Requesting Group' and 'Reason for change'.
I am writing below code to fetch the details in excel but it is not specific to my requirements.
Set hcol = ie.document.getElementsByTagName("td")
For Each inps In hcol
If inps.ID = "SPFieldChoice" Then
Sheets("Sheet2").Range("A" & j).Value = inps.innerText
End If
Next
Need a code which can pull only the required details mentioned above.
This is just a suggestion (I can't verify the answer) but I wanted to illustrate what you could try:
Set hcol = Set hcol = ie.document.getElementsByTagName("td")
For Each inps In hcol
If inps.ID = "SPFieldChoice" Then
If InStr(1, inps.innerHTML, "Requesting Group") > 0 Or InStr(1, it, "Reason for change") > 0 Then
Sheets("Sheet2").Range("A" & j).Value = inps.innerText
End If
End If
Next