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

Discussion in 'Word VBA' started by multilingual.ch@gmail.com, Mar 9, 2014.

  1. Guest

    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
     
    , Mar 9, 2014
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. naveen

    Mac compiler error on mac /windows

    naveen, Nov 3, 2004, in forum: Word VBA
    Replies:
    0
    Views:
    118
    naveen
    Nov 3, 2004
  2. Christopher Brewster via OfficeKB.com

    Letting others use routines I've written

    Christopher Brewster via OfficeKB.com, Jan 11, 2005, in forum: Word VBA
    Replies:
    15
    Views:
    160
    Alex Ivanov
    Jan 26, 2005
  3. Kara
    Replies:
    1
    Views:
    191
    Doug Robbins
    Oct 6, 2005
  4. kiz_nicol
    Replies:
    1
    Views:
    497
    Jezebel
    Jan 27, 2006
  5. Anne Marie
    Replies:
    2
    Views:
    134
    Charles Kenyon
    Apr 18, 2006
  6. Alex St-Pierre

    Modify windows language from VBA Code

    Alex St-Pierre, Jan 25, 2007, in forum: Word VBA
    Replies:
    2
    Views:
    206
    Alex St-Pierre
    Jan 26, 2007
  7. MarS
    Replies:
    2
    Views:
    94
  8. charlie123
    Replies:
    1
    Views:
    96
    Graham Mayor
    Feb 25, 2009
Loading...