Need help in getting price from web page

vikas0903

New Member
Joined
Dec 17, 2013
Messages
20
Hi, I am trying to get price for an item (can be seen by following url below) using VBA:
Natasha Sybil Collar Necklace | Dillards.com

While going through source code, I found element which refers to price as :
<div id="price" style="display:none;">
$78.00
</div>

I tried getting this in VBA by following code:
dim value as string
value = IEapp.document.getElementsByName("price").value

But I am getting error"
Object doesn't support this property or method.

Please help me understand, where I am making error. If someone can tell me correct code, it will be great.

Thanks again for your help.
-Vikas
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You need to declare a IHTMLELEMENT
Dim myEL as IHTMLELEMENT

FOR each myEL in IEapp.document.all
If myEL.id = "price" then
[A1] = myEL.innertext
exit for
end if
next
 
Upvote 0
'**********************
You need to declare a IHTMLELEMENT
Dim myEL as IHTMLELEMENT

FOR each myEL in IEapp.document.all
If myEL.id = "price" then
[A1] = myEL.innertext
exit for
end if
next
'*************************
Thanks for the code VBA Geek. It worked perfectly.
Now I am getting stuck at next webpage, where I am trying to checkout:
https://www.dillards.com/webapp/wcs...derId=.&cm_sp=Header-_-ShoppingBag-_-TextLink

I am not able to clcik on "proceed to checkout" though VBA. I guess id is in this code:

<div class="cart-buttons" id="GroupButtonSet_A">

<div class="checkout-action-item">

<a id="shopCart-continue-shopping" href="TopCategoriesDisplay?langId=-1&storeId=301&catalogId=301" class="secondary"> Continue Shopping</a>
</div>
<div class="continue-checkout">


<button type="button" *******="javascript: document.ShopCartForm.inventoryCheck.value='no';SubmitNewCart(document.ShopCartForm);" class="primary">
Proceed To Checkout
</button>

but when I try to click it using following code, it does not work:
IEapp.document.getElementsByName("GroupButtonSet_A").Item.Click

I guess I am not referencing id correctly. Can you please help me on this? Thanks a lot.
 
Upvote 0
see if this works


FOR each myEL in IEapp.document.all
If trim(myEl.innertext) = "Proceed To Checkout" then
myEl.click
exit for
end if
next
 
Upvote 0

Forum statistics

Threads
1,216,222
Messages
6,129,588
Members
449,520
Latest member
TBFrieds

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top