How to modify a Word macro written for Windows so that will work on MAC

  • Thread starter
  • Start date


is there anyone who could very kindly tell me what changes I need to make to the macro below so that it will work on a MAC?
MANY thanks! :) :) :)

Sub GoogleUk()
' GoogleUk Macro
' This macro looks up a highlighted word in MS Word and searches for it on UK web pages through Google
' Macro created by Tanya Harvey Ciampi on 10/04/2003
Dim theTerm, myURL As String ' theTerm is the term to look up in Google
Dim oIE As Object

On Error GoTo MainStop

If Selection.Type = wdSelectionIP Then
theTerm = Selection.Words(1).Text
theTerm = Selection.Text
End If

theTerm = Replace(theTerm, vbCr, "") ' Remove any soft returns in the phrase that you have highlighted
theTerm = Replace(theTerm, vbLf, "") ' Remove paragraph breaks in the phrase that you have highlighted
theTerm = Trim(theTerm) ' Remove any spaces

myURL = ""
myURL = myURL & "%22" ' add opening quotation marks
myURL = myURL & theTerm ' add closing quotation marks
myURL = myURL & "%22"
myURL = myURL & "+site:uk"

Set oIE = CreateObject("InternetExplorer.Application")
' Activate the Internet Explorer window i.e. bring it to the foreground
oIE.Visible = True
' Navigate to the URL created above
oIE.Navigate (myURL)
SendKeys "{ALT}{TAB}", True
If Err.Number <> 0 Then
Exit Sub
End If

End Sub


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question