This site uses cookies.
Some of these cookies are essential to the operation of the site,
while others help to improve your experience by providing insights into how the site is being used.
For more information, please see the ProZ.com privacy policy.
Samuel Murray Netherlands Local time: 22:13 Member (2006) English to Afrikaans + ...
Jul 3, 2019
Hello everyone
Does anyone know of a Word macro that can be used to send the currently selected text to the browser as a Google search? I'm looking specifically for a Word macro and not for e.g. an AU3 or AHK script.
Thanks Samuel
==
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
wotswot France Local time: 22:13 Member (2011) French to English
Here's the code you need
Jul 3, 2019
Create a module in VBA (in a .dotm file or your normal.dot(m), if you have one) In the new module, copy everything below the dotted line exactly as is. (You may want to localize the google url) Select some text in Word Run the macro (only tested in Windows 7) -------------------------------------------------
Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As Strin... See more
Create a module in VBA (in a .dotm file or your normal.dot(m), if you have one) In the new module, copy everything below the dotted line exactly as is. (You may want to localize the google url) Select some text in Word Run the macro (only tested in Windows 7) -------------------------------------------------
Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub GoogleSearch() 'You can assign this macro to a function key if you want Dim T As String If Len(Trim(Selection.Text)) > 1 Then 'There must be some text selected in Word T = Selection.Text T = Replace(T, " ", "+") 'Words in the query's text must be separated by '+' OpenURL "http://www.google.com/search?as_epq=" & T 'the as_epq parameter means results must include the query, 'in the word order displayed. 'see the link below for a full list of google search URL parameters 'https://moz.com/blog/the-ultimate-guide-to-the-google-search-parameters End If End Sub
Private Function OpenURL(ByVal URLString As String) ShellExecute 0, "open", URLString, 0, 0, 1 End Function ▲ Collapse
Subject:
Comment:
The contents of this post will automatically be included in the ticket generated. Please add any additional comments or explanation (optional)
Translate faster & easier, using a sophisticated CAT tool built by a translator / developer.
Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools.
Download and start using CafeTran Espresso -- for free
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!
The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.