PDA

View Full Version : Google search from highlighted text



concretexfac
07-17-2014, 01:00 PM
Hi all first time poster on this board.

I have been learning Excel VBA for the past couple months and I'm wanting to break into Outlook VBA now. I wrote a line of code in Excel that would take the text from the active cell, open a web browser and do a Google search for whatever was in the cell. I want to do the same with Outlook, except by highlighting text, right clicking and select " Search Google for 'whatever text was highlighted' ". Ive posted my Excel code below if it helps. Thanks.



Sub GoogleActiveCell()

Const Lnk = "I can't post the prefix link to the Google search yet because my account is too young"
ThisWorkbook.FollowHyperlink Lnk & ActiveCell, NewWindow:=True

End Sub





Version of the program 2013
What you want it to do Above
Cell references, bookmark names, column letters, row numbers, worksheets, styles, whatever pertains to the information at hand Text in the outlook message
Error messages if any None yet
If not the entire code, then at least some of it Equivalent Excel code above
Sample data (before and after sample worksheets, add as attachments here) Equivalent Excel code above
Politeness and gratitude Many thanks
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread. Pending

westconn1
07-17-2014, 02:05 PM
while it is doable in outlook, it is much harder than in excel

first it is much harder to return selected text
is the selected text in a open item (inspector window)?
or a preview within an outlook explorer window?

second you would have to either
create an instance of explorer or similar and navigate to the required url, then read the returned webpage document
or shellexecute the url to open a default browser window, depending what you want to achieve

concretexfac
07-18-2014, 12:59 PM
while it is doable in outlook, it is much harder than in excel

first it is much harder to return selected text
is the selected text in a open item (inspector window)?
or a preview within an outlook explorer window?

second you would have to either
create an instance of explorer or similar and navigate to the required url, then read the returned webpage document
or shellexecute the url to open a default browser window, depending what you want to achieve



Hmmm... sounds complicated