Hey, this IS fun! Several adjustments, to make the result lighter...
Sub googlealldoc()
While ActiveDocument.Words.Count > 1
searchtext = ActiveDocument.Words(1).Text
ActiveDocument.Words(1).Delete
searchstring = ""
mylen = Len(searchtext)
If mylen > 2 Then
For i = 1 To mylen
myletter = Mid(searchtext, i, 1)
ascval = Asc(myletter)
If ((ascval > 64) And (ascval < 91)) Or _
((ascval > 96) And (ascval < 124)) Then
searchstring = searchstring & myletter
Else
searchstring = searchstring & "%" & Hex(ascval)
End If
Next i
outstring = outstring _
& "<a href=""http://google.com/search?q=" _
& searchstring & "&btnI=1"">" _
& searchtext & "</a>" _
Else
outstring = outstring & searchtext
End If
Wend
Selection.TypeText Text:=outstring
End Sub
Ok, this is it, I'll think about a google editor to make the intelligent-linking easy, but right now I gonna wach a movie.
No comments:
Post a Comment