Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 31

Thread: Lookup First URL From Google Search Result Using VBA

  1. #11
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    SirJB7,

    May I request you to remove the second last post from the thread you've posted above. We don't offer a Black Amex or any money for helping the MS-Office online community. You must have noted that we give help not just in Excel, but also most of the other applications in the MS-Office Suite.

    We have no disregard for the site you're associated with. We'd expect the same in return. The way I look at it, OP has received three different solutions to the problem, and as solution providers, it should be considered as a win for yourself and us here.

    PS: OP posted the query here at least 4 hours before posting it at the thread you mentioned above. And since most of us are at +5.30 GMT, we were only able to provide a solution in the morning.

    The reasons why we expect someone to register is just for the sake of a figure, that may give us a sense of pride to have X registered members. If you look at Rick Rothstein's Corner, you'd notice that one doesn't need to register to read the thread. We have our own ways of doing things, and I am sure you have your own. You are free to give a thumbs down to what you deem should be 'thumbs-downed', but as a fellow Excellian or as a fellow online help volunteer, we'd expect you to maintain a sense of respect for other communities that are only trying to help others.

    Kris (Admin), and I, we are two different people. Both of us are part of many other forums, and have been helping the online community for many years, having well over 15000 posts between us. Most of the solution providers here are our friends and volunteers who we've come across at different forums and work places. Admonishing someone not to post a cross-post link doesn't come from 'greatness' or even from 'keeping forum sanity in check', but it comes from a sense of contempt and highhandedness.

    On a more regular note, we (and I personally) welcome you to the ExcelFox community. Glad to have you here. Feel free to post MS-Office related suggestions / posts whenever you feel like. Even with your vast experience and knowledge, I am sure there may be fractions of a percentage that we can add to your knowledge.

    Happy helping.

    Regards,
    EF
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #12
    Junior Member SirJB7's Avatar
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0
    Hi, Excel Fox!

    I sincerely apologize for the misunderstanding. As soon as I received the email notice of this message I proceeded to edit the related post trying to clarify and added a link to this thread.

    Absolutely nothing farther from my intentions than starting at a new forum in this way, so I thank you very much for your welcome words. I don't agree with the knowledge flow that may arise. If you could have read my Interest section of my profile at Chandoo's forums there it says: "Technical? Improve and apply". Despite of this I strongly believe in a phrase from Albert Einstein, please forgive if my non-native English play a trick on me: "We are all very ignorant, what happens is that not all ignore the same things".

    Regarding your request of removing the related post I hope that the explanations given were suitable for you. Towards the future I wish that both sides of the scale get balanced, either suggesting solutions or incorporating knowledge.

    Lastly I must say that I completely disagree about your words about crossposting and following actions, but I'll play with the house rules, if I play, so don't expect reading me here alike.

    Best regards.

  3. #13
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    SirJB7,

    We respect your thoughts. No offense taken. And the clarification you've given over there has been taken in the right earnest.

    Regarding cross posting, we here also are in lines with all other forums, including Chandoo and we ask people to inform the forum if the same thread is started elsewhere. My only specific comment above was basis this specific case only. So yes, we agree and feel the same way as you and all other forum volunteers feel about cross posting.

    Would appreciate you helping the online community here as well, as you're doing for other communities.

    Regards from this forum again.

    Thanks,
    EF
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  4. #14
    Junior Member SirJB7's Avatar
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0
    Hi, joparo!
    There's a new enhanced version at the same previous link of my first comment.
    Regards!

  5. #15
    Junior Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0
    Permission to use object denied? any help to fix this error?

  6. #16
    Junior Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0
    hi all, the code stops working as i get a pop up "permission to use the object denied"
    it runs for a while like copies few links and error message 419

    things i tried:

    removed all the add-ins

    logged in as administrator

    stopped using anti virus

    found xlstart folder empty

    error still there, any help?

  7. #17
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    You haven't mentioned which version of the code you are facing problem with. If you facing problem with all the codes, then there must be some administrative problems (can't tell for sure). If it's a specific code from this thread, or from the one from the other link, mention which one.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  8. #18
    Junior Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0
    HTML Code:
    Option Explicit
    
    Sub lm_GetGooleFirstSearchAddres()
    
    
        Dim strHtml                 As String
        Dim lngLoop                 As Long
        Dim rngRange                As Range
        Dim rngCell                 As Range
        
        With ThisWorkbook.Worksheets("Sheet1")
            Set rngCell = .Range("A1").CurrentRegion.Resize(, 1)
            Set rngRange = Nothing
            On Error Resume Next
            Set rngRange = Intersect(rngCell, rngCell.Offset(1))
            On Error GoTo -1: On Error GoTo 0: Err.Clear
            If Not rngRange Is Nothing Then
                For Each rngCell In rngRange
                    With CreateObject("MSXML2.XMLHTTP")
                        .Open "get", URLEncode(rngCell.Value), False
                        .send
                        strHtml = .responseText
                        strHtml = Mid(strHtml, InStr(1, strHtml, "<div id=""ires"">"))
                        strHtml = Mid(strHtml, 1, InStr(1, strHtml, "<div class=""s"">"))
                        strHtml = Mid(strHtml, InStr(1, strHtml, "<a href="))
                        strHtml = Mid(strHtml, InStr(1, strHtml, "<a href="), InStr(1, strHtml, """ onmousedown="""))
                        strHtml = Mid(strHtml, InStr(1, strHtml, """"), Len(strHtml) - 1)
                        rngCell.Offset(, 1).Value = Mid(Trim(strHtml), 2, Len(Trim(strHtml)) - 2)
                    End With
                Next rngCell
                MsgBox "Search completed.", vbInformation, "Google Search..."
            Else
                MsgBox "No data found to search.", vbCritical, "Google Search..."
            End If
        End With
        
        strHtml = vbNullString
        lngLoop = Empty
        Set rngRange = Nothing
        Set rngCell = Nothing
        
    End Sub
    
    
    Function URLEncode(EncodeStr As String) As String
        
        Dim i As Integer
        Dim erg As String
        
        Const strGogSrchUrl         As String = " http://www.google.co.in/search?output=search&sclient=psy-ab&q=|||&btnK="
        Const strConcatDelima       As String = "|||"
        
        erg = EncodeStr
    
    
        ' *** First replace '%' chr
        erg = Replace(erg, "%", Chr(1))
    
    
        ' *** then '+' chr
        erg = Replace(erg, "+", Chr(2))
        
        For i = 0 To 255
            Select Case i
                ' *** Allowed 'regular' characters
                Case 37, 43, 48 To 57, 65 To 90, 97 To 122
                
                Case 1  ' *** Replace original %
                    erg = Replace(erg, Chr(i), "%25")
            
                Case 2  ' *** Replace original +
                    erg = Replace(erg, Chr(i), "%2B")
                    
                Case 32
                    erg = Replace(erg, Chr(i), "+")
            
                Case 3 To 15
                    erg = Replace(erg, Chr(i), "%0" & Hex(i))
            
                Case Else
                    erg = Replace(erg, Chr(i), "%" & Hex(i))
                    
            End Select
        Next
        
        URLEncode = Replace(strGogSrchUrl, strConcatDelima, erg)
        'URLEncode = strGogSrchUrl & erg
        
        i = Empty
        erg = vbNullString
        
    End Function

  9. #19
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Tested the code, it's working absolutely fine here. Can you tell me exactly what are you searching for? Maybe it has something to do with the search word, or its URL.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  10. #20
    Junior Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0
    hi, in excel sheet i got list of ngo companies, when i run this code, it pulls the domain names, after like 70or 80 companies...i get a pop up that " VB Permission to use object denied (Error 419)

Similar Threads

  1. Replies: 4
    Last Post: 04-24-2013, 10:04 AM
  2. Find the highest then lookup result
    By Stalker in forum Excel Help
    Replies: 4
    Last Post: 04-02-2013, 02:04 PM
  3. Import html source of url list in each cell
    By Sergio Alfaro Lloret in forum Excel Help
    Replies: 8
    Last Post: 07-31-2012, 03:03 AM
  4. VBA Function to Search in Array
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 04-10-2012, 11:34 AM
  5. VBA - Excel: Disable Internet / Google
    By technicalupload in forum Excel Help
    Replies: 3
    Last Post: 10-06-2011, 09:18 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •