Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2015, 12:19 AM
macropod's Avatar
macropod macropod is offline Spell check in two languages Windows 7 64bit Spell check in two languages Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Based on what your link shows, try the following macro.

Since your Spanish definitions are in bold type, the macro first builds a list of all those words and applies Spanish proofing to them. The macro then searches for the same words in italics and applies Spanish proofing to them. A progress report is displayed on the status bar for these processes, but they should run very quickly anyway. That should take care of most words. Finally, the macro checks for italicised spelling errors and prompts the user to say whether the word is Spanish; if so, the macro applies Spanish proofing to those words too.
Code:
Sub SetSpanishLanguage()
Application.ScreenUpdating = False
Dim StrTmp As String, i As Long, Rng As Range
StrTmp = " "
Const StrExcl As String = ".,!¡?¿@#$¢£€%^&*(){}[]:;'~`1234567890-_=+\|“”‘’"""
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Font.Bold = True
    .Format = True
    .Forward = True
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found
    If InStr(StrTmp, " " & .Text & " ") = 0 Then
      i = i + 1
      Application.StatusBar = "Adding word " & i & " to Dictionary, please wait."
      StrTmp = StrTmp & .Text & " "
    End If
    .LanguageID = wdSpanish
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
  DoEvents
  For i = 1 To Len(StrExcl)
    StrTmp = Replace(StrTmp, Mid(StrExcl, i, 1), "")
  Next
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.LanguageID = wdSpanish
    .Font.Italic = True
    .Format = True
    .Forward = True
    .Wrap = wdFindContinue
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    For i = 1 To UBound(Split(StrTmp, " ")) - 1
      Application.StatusBar = "Adding Spanish Proofing to word " & i & ", please wait."
      .Text = Split(StrTmp, " ")(i)
      .Replacement.Text = "^&"
      .Execute Replace:=wdReplaceAll
    Next
  End With
End With
Application.ScreenUpdating = True
With ActiveDocument.Range
  For Each Rng In .SpellingErrors
    With Rng
      If .Font.Italic = True Then
        .Select
        If MsgBox("Is this a Spanish word?", vbYesNo, "Language Checker") = vbYes Then
          .LanguageID = wdSpanish
        End If
      End If
    End With
  Next
End With
End Sub

__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell Check HondaS600 Office 5 08-26-2013 01:04 PM
Spell check in two languages spell check error Straitsfan Word 1 09-16-2012 03:35 PM
Spell check in two languages spell checker won't check mrmagoo Word 1 08-25-2012 04:55 PM
Spell check in two languages Spell Check CommoMP Word 5 05-30-2011 05:40 PM
Spell Check WorkerB Word 2 11-21-2009 07:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft