ferocious12
Member
Hi All,
I have following code it:
1. open a webpage (amazon in this case)
2. click on all the products appearing on the page ( and open each product in new tab)
Can you help me to update the code to include a loop:
3. go through each open tab (from step 2) and
4. copy the product title to column A of active sheet (
I have included the screenshot of how the result will look like.
I have following code it:
1. open a webpage (amazon in this case)
2. click on all the products appearing on the page ( and open each product in new tab)
Can you help me to update the code to include a loop:
3. go through each open tab (from step 2) and
4. copy the product title to column A of active sheet (
I have included the screenshot of how the result will look like.
Code:
Sub launch_amazon()
Dim IE As SHDocVw.InternetExplorer
Set IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.Navigate "https://www.amazon.in/s?k=rudra+fashion&rh=p_n_size_two_browse-vebin%3A1975333031&dc&crid=2AKWK100N33Q9&qid=1574534623&rnid=1974754031&sprefix=rudra+fas%2Caps%2C287&ref=sr_nr_p_n_size_two_browse-vebin_8"
Do While IE.ReadyState <> READYSTATE_COMPLETE
Application.StatusBar = "Loading"
Loop
Dim idoc As mshtml.HTMLDocument
Set idoc = IE.Document
Dim doc_ele As mshtml.IHTMLElement
Dim doc_eles As mshtml.IHTMLElementCollection
Set doc_eles = idoc.getElementsByTagName("img")
For Each doc_ele In doc_eles
If doc_ele.className = "s-image" Then
doc_ele.Click
End If
Next doc_ele
' loop required here
End Sub
Attachments
Last edited: