copy hyperlink

namrata

New Member
Joined
Nov 11, 2010
Messages
21
hi,

I want to Copy hyperlink form my source code to my excel sheet. please tell me how to do it.:confused:
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Sorry, I don't understand. Where do you want to copy the hyperlink from? If you have any existing VBA code please post it.
 
Upvote 0
vba Code

"Private Sub CommandButton2_Click()
UserForm1.WebBrowser1.Silent = True
Dim Strhtml As String
Dim cntr, a As Integer
cntr = 0
j = 2
a = WorksheetFunction.CountA(Sheet1.Range("A:A"))
UserForm1.TextBox2.Value = a - 1

UserForm1.WebBrowser1.navigate "http://www.amazon.com"
delay 5
While UserForm1.WebBrowser1.readyState = READYSTATE_LOADING
delay 4
Wend

'Do
'j = 2
'On Error Resume Next

While Sheet1.Range("A" & j) <> ""
UserForm1.TextBox1.Value = j
UserForm1.WebBrowser1.navigate "http://www.amazon.com"
delay 5
While UserForm1.WebBrowser1.readyState = READYSTATE_LOADING
delay 4
Wend
Product_Name = Sheet1.Range("A" & j)
Web_Product_Name1 = Sheet1.Range("B" & j)
UserForm1.WebBrowser1.document.getElementById("twotabsearchtextbox").Value = Product_Name
On Error GoTo n

UserForm1.WebBrowser1.document.forms(0).submit

UserForm1.WebBrowser1.document.getElementById("navGoButton").Click

'UserForm1.WebBrowser1.document.getElementById("btnSearch").Click
delay 5
While UserForm1.WebBrowser1.readyState = READYSTATE_LOADING
delay 4
Wend
'UserForm1.WebBrowser1.document.getElementById("search_header").Clicked

Strhtml = UserForm1.WebBrowser1.document.DocumentElement.innerHTML
If InStr(1, Strhtml, "We can't find anything that matches your request") Then
GoTo n
Else
'bunch = GetText1(Strhtml, "productTitle", "</div>")
'bunch = GetText1(Strhtml, "companySearchResults", "</tr>")

'While InStr(1, bunch, "</TR>")
'bunch1 = GetText2(bunch, "<TR", "</TR>")
'comp_nm = GetText2(bunch, "=all>", "</a>")
'Sheet1.Range("B" & j).value = Web_Product_Name1
'bunch1 = GetText2(bunch, "<title", "</title>")
'comp_link = GetText2(bunch1, "Href=", "nodeIndex")
Strhtml = UserForm1.WebBrowser1.document.DocumentElement.innerHTML
bunch = GetText2(Strhtml, "=hl-duplicate-faceout>", "</a>")
bunch1 = GetText2(Strhtml, "=hl-duplicate-faceout>", "</a>")
ActiveCell.Offset(0, 1).Value = bunch1
ActiveCell.Offset(0, 4).Value = bunch
bunch2 = GetText2(Strhtml, "border=0><BR clear=all>", "</a")
ActiveCell.Offset(0, 2).Value = bunch2
bunch3 = GetText2(Strhtml, "=newPrice>", "</div>")
bunch4 = GetText2(bunch3, "<span>", "</span>")
ActiveCell.Offset(0, 3).Value = bunch4
ActiveCell.Offset(1, 0).Select
n:
j = j + 1
End If
cntr = cntr + 1
If cntr = 100 Then
ThisWorkbook.Save
delay 5
cntr = 1
End If
Wend
Exit Sub

End Sub
"


links i want to copy from source

<a href="wwwdotamazondotcom/AME-Sleepwear-Boys-Roddin-Pajama/dp/B0041ORYRS/ref=lh_di_t_dup
_" title="AME Sleepwear Boys 2-7 Hot Roddin' Coat Pajama, Navy, 3T"
class="hlb-item-link hlb-asin-B0041ORYRS">
<img src="http://ecx.images-amazon.com/images/I/51B4A6XZYdL._SL500_SS40_.jpg"
width="40" alt="" class="hlb-product-image" height="40" border="0" />
<span class="hlb-item-title">
AME Sleepwear Boys 2-7 Hot Roddin' Coat Pajama, Navy, 3T</span>



My Excel has only product information which get copied into the search box and then after clicking on go button i want to copy the url.
which has the product Code.
</pre>
 
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,883
Members
449,477
Latest member
panjongshing

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