M
multilingual.ch
Hello,
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!
Tanya
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
Else
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 = "https://www.google.com/#hl=en&sclient=psy-ab&q="
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
MainStop:
If Err.Number <> 0 Then
Exit Sub
End If
End Sub
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!
Tanya
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
Else
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 = "https://www.google.com/#hl=en&sclient=psy-ab&q="
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
MainStop:
If Err.Number <> 0 Then
Exit Sub
End If
End Sub