Tecnologia al servei de la correcció


Macro ampliaDiccionariPersonal

Aquesta macro permet alimentar el diccionari personal de l'usuari, a condició que coneguem el seu nom i la trajectòria on es troba.

Sub ampliaDiccionariPersonal()
'
' Macro ampliaDiccionariPersonal
' Macro grabada el 04/11/04 por Lluís de Yzaguirre
'
' Si treiem els mots d'un document, activem les dues línies següents
    
' cal assegurar la ubicació del diccionari personal
    Documents.Open FileName:= _
        "C:\Archivos de programa\Microsoft Office\Office\PERSONAL.DIC"
    If ActiveWindow.View.SplitSpecial = wdPaneNone Then
        ActiveWindow.ActivePane.View.Type = wdPageView
    Else
        ActiveWindow.View.Type = wdPageView
    End If
    Application.DisplayStatusBar = True
    With ActiveWindow
        .DisplayHorizontalScrollBar = True
        .DisplayVerticalScrollBar = True
        .DisplayVerticalRuler = True
        .DisplayScreenTips = False
        With .View
            .ShowAnimation = True
            .ShowPicturePlaceHolders = False
            .ShowFieldCodes = False
            .ShowBookmarks = False
            .FieldShading = wdFieldShadingWhenSelected
            .ShowTabs = False
            .ShowSpaces = False
            .ShowParagraphs = False
            .ShowHyphens = False
            .ShowHiddenText = False
            .ShowAll = False
            .ShowDrawings = True
            .ShowObjectAnchors = False
            .ShowTextBoundaries = False
            .ShowHighlight = True
        End With
    End With
    With Options
        .CheckSpellingAsYouType = False
        .CheckGrammarAsYouType = False
        .SuggestSpellingCorrections = True
        .SuggestFromMainDictionaryOnly = False
        .CheckGrammarWithSpelling = False
        .ShowReadabilityStatistics = False
        .IgnoreUppercase = True
        .IgnoreMixedDigits = True
        .IgnoreInternetAndFileAddresses = True
    End With
'    ActiveDocument.ShowGrammaticalErrors = True
'    ActiveDocument.ShowSpellingErrors = True
'    Languages(wdCatalan).SpellingDictionaryType = wdSpelling
'    Languages(wdCatalan).DefaultWritingStyle = ""
'    ActiveDocument.ActiveWritingStyle(wdCatalan) = ""
    With CustomDictionaries
        .Add("C:\Archivos de programa\Microsoft Office\Office\PERSONAL.DIC"). _
            LanguageSpecific = False
        With .Add( _
            "C:\Archivos de programa\Archivos comunes\Microsoft Shared\proof\patologia.DIC" _
            )
            .LanguageSpecific = True
            .LanguageID = wdCatalan
        End With
        .ActiveCustomDictionary = CustomDictionaries.Item( _
            "C:\Archivos de programa\Microsoft Office\Office\PERSONAL.DIC")
    End With
' ----------------------------------------------------------
Selection.TypeText Text:="Jessica"
Selection.TypeParagraph
Selection.TypeText Text:="Yzaguirre"
Selection.TypeParagraph
Selection.TypeText Text:="Jones"
Selection.TypeParagraph
Selection.TypeText Text:="José"
Selection.TypeParagraph
Selection.TypeText Text:="Kerry"
Selection.TypeParagraph
Selection.TypeText Text:="Lana2"
Selection.TypeParagraph
Selection.TypeText Text:="LesFinances"
Selection.TypeParagraph
Selection.TypeText Text:="Libération"
Selection.TypeParagraph
Selection.TypeText Text:="Linguacom"
Selection.TypeParagraph
Selection.TypeText Text:="Linux"
Selection.TypeParagraph
' ----------------------------------------------------------
    ActiveDocument.Save
    ActiveDocument.Close
End Sub

Nota: aquesta macro es pot incloure en un document que en faciliti la instal·lació com l'exemple AmpliaDiccionariPersonal.doc
Si tenim una llista de mots a incloure en la macro precedent, ens podem servir de la macro preparaMacroADP:

'
' Macro preparaMacroADP (ampliaDiccionariPersonal)
'
' Macro enregistrada per Lluís de Yzaguirre i Maura
' Institut de Lingüística Aplicada
' Universitat "Pompeu Fabra"
'
' Agafa tots els mots d'un document i els prepara per tal que
' puguin ser afegits a la macro ampliaDiccionariPersonal
'

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ""
        .Replacement.Text = _
            "Selection.TypeText Text:=""^&""^pSelection.TypeParagraph"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub


Per comentaris i observacions, poseu-vos en contacte amb Lluís de Yzaguirre

Pàgina servida per XITAMI