Patricia Brenes
asked on
Modify code to open in GC
Hi. Could someone help me modify this macro to open in Google Chrome instead of IE?
Sub Dictionaries()
' Look at different dictionaries
Dim theTerm As String ' Term to look up in dictionary
Dim strURL As String ' The URL to open in Explorer
Dim obj As Object ' Explorer
Dim arrSites(3)
' If nothing is selected
If Selection.Type = wdSelectionIP Then
' Select the term where the cursor is located
theTerm = Selection.Words(1).Text
Else
' Use the current selection
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
arrSites(0) = "https://cms.unov.org/UNTERM//search?urlQuery=" + theTerm
arrSites(1) = "http://iate.europa.eu/SearchByQueryLoad.do?method=load" + theTerm
arrSites(2) = "http://www.btb.termiumplus.gc.ca/tpv2alpha/alpha-fra.html?lang=fra&i=1&srchtxt=" + theTerm
arrSites(3) = "https://www.linguee.com/english-spanish/search?source=auto&query=" + theTerm + "&title=21st"
Set objIE = CreateObject("InternetExpl orer.Appli cation")
For i = 0 To 3 Step 1
strURL = arrSites(i)
If i = 0 Then
objIE.Navigate strURL
Else
objIE.Navigate2 strURL, 2048
End If
Next i
objIE.Visible = True
Set objIE = Nothing
End Sub
Sub Dictionaries()
' Look at different dictionaries
Dim theTerm As String ' Term to look up in dictionary
Dim strURL As String ' The URL to open in Explorer
Dim obj As Object ' Explorer
Dim arrSites(3)
' If nothing is selected
If Selection.Type = wdSelectionIP Then
' Select the term where the cursor is located
theTerm = Selection.Words(1).Text
Else
' Use the current selection
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
arrSites(0) = "https://cms.unov.org/UNTERM//search?urlQuery=" + theTerm
arrSites(1) = "http://iate.europa.eu/SearchByQueryLoad.do?method=load" + theTerm
arrSites(2) = "http://www.btb.termiumplus.gc.ca/tpv2alpha/alpha-fra.html?lang=fra&i=1&srchtxt=" + theTerm
arrSites(3) = "https://www.linguee.com/english-spanish/search?source=auto&query=" + theTerm + "&title=21st"
Set objIE = CreateObject("InternetExpl
For i = 0 To 3 Step 1
strURL = arrSites(i)
If i = 0 Then
objIE.Navigate strURL
Else
objIE.Navigate2 strURL, 2048
End If
Next i
objIE.Visible = True
Set objIE = Nothing
End Sub
Thanks for taking the time to do this. Really appreciated. It worked!
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Check this code
Open in new window