unpuertomex
New Member
- Joined
- May 20, 2014
- Messages
- 22
Hopefully someone can help me, I've been banging my head for a week now so I'm turning to the pros. Unfortunately I cannot post the website for testing as it is an internal site but I can post the html of where I'm having the problem.
What am I trying to accomplish? I have a spreadsheet that contains over 200 entries that we must look up on a website and if certain criteria is met we have to edit the text online.
The VBA code must loop through each record on the spreadsheet, enter it into a search box, wait for the results, click the first link, wait for the results, look at a setting and if certain text is present click a button, go down to a section and change the content of a listbox, then click the save button and finally repeat the process for the next record.
Below is what I have so far and by the way I've cobbled this together by reading different websites and I'm testing with static information as I do not know how to loop through a spreadsheet. The code I'm getting stuck on so far is this one, I cannot get it to click the link...:
If Hyper_link.innertext = "0016239000" Then
Hyper_link.Click
This is the the rest of the code:
This is a snippet of the html on the website
<form accept-charset="UTF-8" action="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<input id="query" name="query" type="text" value="16239000" />
<input name="commit" type="submit" value="Search" />
</form>
<div class="section-footer-clear">
<div class="actions">
</div></div>
<div class="section-header clearfix ">
<h2>Results</h2>
<div class="actions">
</div>
</div>
<div id="skus_table">
<div id="skus" >
<div class="dt" >
<div class="header row">
<div class="cell " style="width: 25%;;" >Item</div>
<div class="cell " style="width: 20%;;" >Description</div>
<div class="cell " style="width: 50%;;" >Customer</div>
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="A tooltip">0016239000</a></div>
<div class="cell " style="width: 20%;;" data-tooltip="Another tooltip">Another tooltip</div>
<div class="cell " style="width: 50%;;" ><a href="/customers/3272" class="info_link" data-tooltip="Customer Name">Customer Name</a></div>
</div></div>
<div id='' class='table-footer-empty'><p></p></div></div></div></div>
<div id="subcomponents_table">
<div id="subcomponents" >
<div class="dt" >
<div class="header row">
<div class="cell " style="width: 25%;;" >Subcomponent</div>
<div class="cell " style="width: 25%;;" >Finished Good</div>
<div class="cell " style="width: 40%;;" >Finished Good Description</div>
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="Tootltip">0016239000</a></div>
<div class="cell " style="width: 25%;;" ><a href="/skus/425944" class="info_link" data-tooltip="Tooltip">0062891000</a></div>
<div class="cell " style="width: 40%;;" data-tooltip="More text">More text</div>
</div></div><div class="row "><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="The tooltip continue">0016239000</a></div>
<div class="cell " style="width: 25%;;" ><a href="/skus/459422" class="info_link" data-tooltip="The tooltip continue">0321987000</a></div>
<div class="cell " style="width: 40%;;" data-tooltip="The tooltip continue">The tooltip continue</div>
I'm trying to click on the link listed below, it is always the first one in the search, also note that it is the item that was searched but with two leading zeros.
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="A tooltip">0016239000</a></div>
There is more to this but this is where I'm stuck at the moment.
Thanks for your help!
What am I trying to accomplish? I have a spreadsheet that contains over 200 entries that we must look up on a website and if certain criteria is met we have to edit the text online.
The VBA code must loop through each record on the spreadsheet, enter it into a search box, wait for the results, click the first link, wait for the results, look at a setting and if certain text is present click a button, go down to a section and change the content of a listbox, then click the save button and finally repeat the process for the next record.
Below is what I have so far and by the way I've cobbled this together by reading different websites and I'm testing with static information as I do not know how to loop through a spreadsheet. The code I'm getting stuck on so far is this one, I cannot get it to click the link...:
If Hyper_link.innertext = "0016239000" Then
Hyper_link.Click
This is the the rest of the code:
Code:
Sub Test()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate ("https://packmanager.nulogy.net/search?utf8=%E2%9C%93&query=&commit=Search&authenticity_token=zGJITDEnJlJID1yTLpzKAVYD5%2Fcsa3pUKZtbJXK2uyg%3D&authenticity_token=zGJITDEnJlJID1yTLpzKAVYD5%2Fcsa3pUKZtbJXK2uyg%3D")
While ie.readyState <> 4
DoEvents
Wend
ie.Document.GetElementByID("query").Value = "16239000"
ie.Document.forms(0).Item("commit").Click
While ie.readyState <> 4
DoEvents
Wend
Set AllHyperLinks = ie.Document.GetElementsByTagName("a")
For Each Hyper_link In AllHyperLinks
If Hyper_link.innertext = "0016239000" Then
Hyper_link.Click
Exit For
End If
Next
End Sub
This is a snippet of the html on the website
<form accept-charset="UTF-8" action="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<input id="query" name="query" type="text" value="16239000" />
<input name="commit" type="submit" value="Search" />
</form>
<div class="section-footer-clear">
<div class="actions">
</div></div>
<div class="section-header clearfix ">
<h2>Results</h2>
<div class="actions">
</div>
</div>
<div id="skus_table">
<div id="skus" >
<div class="dt" >
<div class="header row">
<div class="cell " style="width: 25%;;" >Item</div>
<div class="cell " style="width: 20%;;" >Description</div>
<div class="cell " style="width: 50%;;" >Customer</div>
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="A tooltip">0016239000</a></div>
<div class="cell " style="width: 20%;;" data-tooltip="Another tooltip">Another tooltip</div>
<div class="cell " style="width: 50%;;" ><a href="/customers/3272" class="info_link" data-tooltip="Customer Name">Customer Name</a></div>
</div></div>
<div id='' class='table-footer-empty'><p></p></div></div></div></div>
<div id="subcomponents_table">
<div id="subcomponents" >
<div class="dt" >
<div class="header row">
<div class="cell " style="width: 25%;;" >Subcomponent</div>
<div class="cell " style="width: 25%;;" >Finished Good</div>
<div class="cell " style="width: 40%;;" >Finished Good Description</div>
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="Tootltip">0016239000</a></div>
<div class="cell " style="width: 25%;;" ><a href="/skus/425944" class="info_link" data-tooltip="Tooltip">0062891000</a></div>
<div class="cell " style="width: 40%;;" data-tooltip="More text">More text</div>
</div></div><div class="row "><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="The tooltip continue">0016239000</a></div>
<div class="cell " style="width: 25%;;" ><a href="/skus/459422" class="info_link" data-tooltip="The tooltip continue">0321987000</a></div>
<div class="cell " style="width: 40%;;" data-tooltip="The tooltip continue">The tooltip continue</div>
I'm trying to click on the link listed below, it is always the first one in the search, also note that it is the item that was searched but with two leading zeros.
</div>
<div class="row altrow"><div id='sku_312352' class="row">
<div class="cell " style="width: 25%;;" ><a href="/skus/312352" class="info_link" data-tooltip="A tooltip">0016239000</a></div>
There is more to this but this is where I'm stuck at the moment.
Thanks for your help!