I am pretty new to the whole VB thing, but I am trying to write a script to pull certain information off of an email. I know I probably could cut and paste but where is the fun in that! Using an IE window I want to pull Sku's and the Qty and drop them into my POS system. I can get it to do the first one, but after that I know I need a loop to keep it going, but also the data that needs to be collected is in a different place on the page. Here is the code...
'Grab a collection of all the table elements in the webpage. The Ship To information resides in the fourth table element (count is zero based)
Set ColInputs = IE.Document.getElementsByTagName("table")
Set x = ColInputs.item(6)
'Grab a collection of all the td elements in the selected table element. The Ship To information resides in the first td element (count is zero based)
Set xData = x.getElementsByTagName("td")
Set skuData = xData.item(1)
Set qtyData = xData.item(2)
strSkuInfo = Trim(skuData.innerHTML)
'MsgBox strSkuInfo
Dim skuDataPart
skuDataPart = strSkuInfo
strQtyInfo = Trim(qtyData.innerHTML)
'MsgBox strQtyInfo
Dim QtyItem
Qtyitem = strQtyInfo
It is all based in the same table field, but the <td> fields will increase by 4 each time. I am not sure how to tell it what to do. I also am not sure how to tell it to stop. Sometimes there is 1 item, sometimes there are 20! Like I said I am still pretty new to this stuff and had a buddy help me to get to this point. Any help on this is greatly appreciated.
'Grab a collection of all the table elements in the webpage. The Ship To information resides in the fourth table element (count is zero based)
Set ColInputs = IE.Document.getElementsByTagName("table")
Set x = ColInputs.item(6)
'Grab a collection of all the td elements in the selected table element. The Ship To information resides in the first td element (count is zero based)
Set xData = x.getElementsByTagName("td")
Set skuData = xData.item(1)
Set qtyData = xData.item(2)
strSkuInfo = Trim(skuData.innerHTML)
'MsgBox strSkuInfo
Dim skuDataPart
skuDataPart = strSkuInfo
strQtyInfo = Trim(qtyData.innerHTML)
'MsgBox strQtyInfo
Dim QtyItem
Qtyitem = strQtyInfo
It is all based in the same table field, but the <td> fields will increase by 4 each time. I am not sure how to tell it what to do. I also am not sure how to tell it to stop. Sometimes there is 1 item, sometimes there are 20! Like I said I am still pretty new to this stuff and had a buddy help me to get to this point. Any help on this is greatly appreciated.