Hi

Originally Posted by
Bill
tried to run this macro and I got attached issue, please check attached file.
_ I assume you are talking about the macro I gave?
_ I have never seen the error, System Error H80070685 (-2147023179). The interface is unknown , before.
_ The attached file only has the macro Sub Gethits() in it. So I am not sure what the attached File is supposed to be do with that error issue?
I did a quick search on the internet and could not find anything specifically on that error. But similar errors seemed to be either something to do with internet or windows issues.
It sounds like something not directly related to the coding.

Originally Posted by
Bill
...
I got another macro and give the first result from google but the result contain that the website + Title in the same cell.
So Is there ability to get the hyperlinks only as below.
Searched word is 3M
Current result:
Web results
3M Science. Applied to Life. 3M United Stateswww.3m.comwww.3m.com
Cached
3M applies science and innovation to make a real impact by igniting progress and inspiring innovation in lives and communities across the globe.
About 3M • Products • Covid-19 • Personal Protective Equipment
Expected result from macro after the update:
https://www.3m.com/. ..
The macro Sub Gethits() looks like the typical web scrapping coding.
As I mentioned, I don’t have much experience with such coding
That macro works for me and I also get the same results that you get.
I will take a guess that the macro is supposed to get those results. Where did you get that macro?
I expect that you will need to adjust this section to get the hyperlink.
Code:
Set objResultDiv = html.getelementbyid("rso")
Set var1 = html.getelementbyid("result-Stats")
If Not var1 Is Nothing Then
Cells(x, 2).Value = objResultDiv.Child.innerText
Else
Cells(x, 2).Value = "0"
End If
But I do not know what changes are needed.
If I run my macro with this,
_____ Workbook: GoogleLookupUrl (2).xls ( Using Excel 2007 32 bit )
| Row\Col |
A |
B |
1 |
NGO List |
URL |
2 |
ExcelFox |
|
3 |
Chandoo |
|
4 |
indianrailway |
|
5 |
neustar |
|
6 |
MrExcel |
|
7 |
Ozgrid |
|
8 |
3M |
|
Worksheet: Sheet1
Then I get these results
_____ Workbook: GoogleLookupUrl (2).xls ( Using Excel 2007 32 bit )
| Row\Col |
A |
B |
1 |
NGO List |
URL |
2 |
ExcelFox |
http://www.excelfox.com/forum/forum.php |
3 |
Chandoo |
https://chandoo.org/ |
4 |
indianrailway |
http://www.indianrail.gov.in/ |
5 |
neustar |
https://www.home.neustar/ |
6 |
MrExcel |
https://www.mrexcel.com/ |
7 |
Ozgrid |
https://www.ozgrid.com/ |
8 |
3M |
https://www.3m.com/ |
Worksheet: Sheet1
I don’t know why the macro does not work for you.
As I mentioned previously, I don’t know much about these sort of internet codings.
Alan
Bookmarks