εκτύπωση θέματος   βρείτε μας στο facebook   σχόλια - παρατηρήσεις
Θέση: Ενότητες θεμάτων / Μακροεντολές / Μετατροπή ελληνικών - αγγλικών χαρακτήρων
  
αναζήτηση σε adaeion.gr

σχετικά θέματα Σχετικά θέματα

Τι πρέπει να γνωρίζετε για τις μακροεντολές

Γνωριμία με τον Visual Basic Editor

Εγκατάσταση μακροεντολής

Αντιστοίχιση συντόμευσης πληκτρολογίου σε ενέργεια ή λειτουργία του Word

Προσθήκη κουμπιού στην γραμμή εργαλείων σύντομης πρόσβασης

Προσαρμογή της κορδέλας στο Word 2010

Μακροεντολή μετατροπής ελληνικών <--> αγγλικών χαρακτήρων

Η επόμενη μακροεντολή είναι χρήσιμη σ' αυτούς που κάνουν συχνές αλλαγές πληκτρολογίου, ώστε να γράφουν αγγλικό και ελληνικό κείμενο στο ίδιο έγγραφο. Σας επιτρέπει να μετατρέψετε χαρακτήρες, λέξεις και προτάσεις που έχετε γράψει με "λάθος πληκτρολόγιο". Δηλαδή θέλατε να γράψετε με ελληνικά αλλά ξεχάσατε το πληκτρολόγιο γυρισμένο στα αγγλικά, και το αντίστροφο.

Sub ChangeLang()
    '
    ' Μετατροπή χαρακτήρων Αγγλικά <--> Ελληνικά
    ' Microsoft Corporation
    ' Συντάκτης: Κυριάκος Αποστολίδης
    '

Dim SelectionSize As Integer
Dim TranslatedSelection As String
Dim CurrentCharacter As String

If Documents.Count = 0 Then Exit Sub

StatusBar = "Παρακαλώ περιμένετε..."

TranslatedSelection = ""

SelectionSize = Selection.Characters.Count
If Selection.Start = Selection.End Then
    MsgBox "Δεν έχετε επιλέξει κείμενο!"
    Exit Sub
End If
For i = 1 To SelectionSize

    CurrentCharacter = Selection.Characters(i)
    If (Selection.Characters(i).LanguageID = wdEnglishUS Or _
        Selection.Characters(i).LanguageID = wdEnglishUK) _
        And i < SelectionSize _
        And (Selection.Characters(i) = ";" Or _
            Selection.Characters(i) = ":") Then

        i = i + 1

        CurrentCharacter = CurrentCharacter & Selection.Characters(i)

      End If
      TranslatedSelection = TranslatedSelection & Translate(CurrentCharacter)
Next

Selection = TranslatedSelection
If (Selection.LanguageID = wdEnglishUS Or Selection.LanguageID = wdEnglishUK) Then
      Selection.LanguageID = wdGreek
Else
      Selection.LanguageID = wdEnglishUS
End If
End Sub

Function Translate(InputStr As String) As String
Dim OutputStr As String

Select Case (InputStr)

' SPACE remains the same (for speed added here)
    Case " ": OutputStr = " "

' Wanted Greek but used English keyboard (lower case)
    Case ";a": OutputStr = "ά"
    Case ";e": OutputStr = "έ"
    Case ";h": OutputStr = "ή"
    Case ";i": OutputStr = "ί"
    Case ";o": OutputStr = "ό"
    Case ";y": OutputStr = "ύ"
    Case ";v": OutputStr = "ώ"

    Case ":i": OutputStr = "ϊ"
    Case ":y": OutputStr = "ϋ"

    Case "q": OutputStr = ";"
    Case "w": OutputStr = "ς"
    Case "e": OutputStr = "ε"
    Case "r": OutputStr = "ρ"
    Case "t": OutputStr = "τ"
    Case "y": OutputStr = "υ"
    Case "u": OutputStr = "θ"
    Case "i": OutputStr = "ι"
    Case "o": OutputStr = "ο"
    Case "p": OutputStr = "π"
    Case "a": OutputStr = "α"
    Case "s": OutputStr = "σ"
    Case "d": OutputStr = "δ"
    Case "f": OutputStr = "φ"
    Case "g": OutputStr = "γ"
    Case "h": OutputStr = "η"
    Case "j": OutputStr = "ξ"
    Case "k": OutputStr = "κ"
    Case "l": OutputStr = "λ"
    Case "z": OutputStr = "ζ"
    Case "x": OutputStr = "χ"
    Case "c": OutputStr = "ψ"
    Case "v": OutputStr = "ω"
    Case "b": OutputStr = "β"
    Case "n": OutputStr = "ν"
    Case "m": OutputStr = "μ"

' Wanted English but used Greek keyboard (lower case)
    Case "ά": OutputStr = ";a"
    Case "έ": OutputStr = ";e"
    Case "ή": OutputStr = ";h"
    Case "ί": OutputStr = ";i"
    Case "ό": OutputStr = ";o"
    Case "ύ": OutputStr = ";y"
    Case "ώ": OutputStr = ";v"

    Case "ϊ": OutputStr = ":i"
    Case "ϋ": OutputStr = ":y"
    Case "ΐ": OutputStr = "Wi"
    Case "ΰ": OutputStr = "Wy"

    Case ";": OutputStr = "q"
    Case "ς": OutputStr = "w"
    Case "ε": OutputStr = "e"
    Case "ρ": OutputStr = "r"
    Case "τ": OutputStr = "t"
    Case "υ": OutputStr = "y"
    Case "θ": OutputStr = "u"
    Case "ι": OutputStr = "i"
    Case "ο": OutputStr = "o"
    Case "π": OutputStr = "p"
    Case "α": OutputStr = "a"
    Case "σ": OutputStr = "s"
    Case "δ": OutputStr = "d"
    Case "φ": OutputStr = "f"
    Case "γ": OutputStr = "g"
    Case "η": OutputStr = "h"
    Case "ξ": OutputStr = "j"
    Case "κ": OutputStr = "k"
    Case "λ": OutputStr = "l"
    Case "ζ": OutputStr = "z"
    Case "χ": OutputStr = "x"
    Case "ψ": OutputStr = "c"
    Case "ω": OutputStr = "v"
    Case "β": OutputStr = "b"
    Case "ν": OutputStr = "n"
    Case "μ": OutputStr = "m"

' Wanted Greek but used English keyboard (upper case)
    Case ";A": OutputStr = "Ά"
    Case ";E": OutputStr = "Έ"
    Case ";H": OutputStr = "Ή"
    Case ";I": OutputStr = "Ί"
    Case ";O": OutputStr = "Ό"
    Case ";Y": OutputStr = "Ύ"
    Case ";V": OutputStr = "Ώ"

    Case ":I": OutputStr = "Ϊ"
    Case ":Y": OutputStr = "Ϋ"

    Case "Q": OutputStr = ":"
    Case "W": OutputStr = "΅"
    Case "E": OutputStr = "Ε"
    Case "R": OutputStr = "Ρ"
    Case "T": OutputStr = "Τ"
    Case "Y": OutputStr = "Υ"
    Case "U": OutputStr = "Θ"
    Case "I": OutputStr = "Ι"
    Case "O": OutputStr = "Ο"
    Case "P": OutputStr = "Π"
    Case "A": OutputStr = "Α"
    Case "S": OutputStr = "Σ"
    Case "D": OutputStr = "Δ"
    Case "F": OutputStr = "Φ"
    Case "G": OutputStr = "Γ"
    Case "H": OutputStr = "Η"
    Case "J": OutputStr = "Ξ"
    Case "K": OutputStr = "Κ"
    Case "L": OutputStr = "Λ"
    Case "Z": OutputStr = "Ζ"
    Case "X": OutputStr = "Χ"
    Case "C": OutputStr = "Ψ"
    Case "V": OutputStr = "Ω"
    Case "B": OutputStr = "Β"
    Case "N": OutputStr = "Ν"
    Case "M": OutputStr = "Μ"

' Wanted English but used Greek keyboard (upper case)
    Case ":": OutputStr = "Q"
    Case "΅": OutputStr = "W"
    Case "Ε": OutputStr = "E"
    Case "Ρ": OutputStr = "R"
    Case "Τ": OutputStr = "T"
    Case "Υ": OutputStr = "Y"
    Case "Θ": OutputStr = "U"
    Case "Ι": OutputStr = "I"
    Case "Ο": OutputStr = "O"
    Case "Π": OutputStr = "P"
    Case "Α": OutputStr = "A"
    Case "Σ": OutputStr = "S"
    Case "Δ": OutputStr = "D"
    Case "Φ": OutputStr = "F"
    Case "Γ": OutputStr = "G"
    Case "Η": OutputStr = "H"
    Case "Ξ": OutputStr = "J"
    Case "Κ": OutputStr = "K"
    Case "Λ": OutputStr = "L"
    Case "Ζ": OutputStr = "Z"
    Case "Χ": OutputStr = "X"
    Case "Ψ": OutputStr = "C"
    Case "Ω": OutputStr = "V"
    Case "Β": OutputStr = "B"
    Case "Ν": OutputStr = "N"
    Case "Μ": OutputStr = "M"

    Case Else: OutputStr = InputStr

End Select

Translate = OutputStr

End Function

Επιλέξτε τον κώδικα και αντιγράψτε τον στο Πρόχειρο (CTRL+C). Στη συνέχεια κάνετέ τον επικόλληση (CTRL+V) σε ένα module του βασικού προτύπου (Normal.dotm), ώστε η μακροεντολή να είναι διαθέσιμη σε όλα τα έγγραφα. Για αναλυτικές οδηγίες δείτε το θέμα Εγκατάσταση μακροεντολής [1]. Μπορείτε να αντιστοιχίσετε την μακροεντολή [2] σε μία συντόμευση πληκτρολογίου ή σε ένα κουμπί της γραμμής εργαλείων σύντομης πρόσβασης (QAT).

ΣΗΜΕΙΩΣΗ Σε ορισμένες περιπτώσεις, μετά την εκτέλεση της μακροεντολής, θα παρατηρήσετε ότι τα τονισμένα γράμματα δεν μετατρέπονται σωστά. Π.χ. η λέξη "dokim;h" αντί για "δοκιμή" μετατρέπεται σε "δοκιμqη". Αυτό συμβαίνει γιατί το Word δεν αναγνωρίζει πάντοτε σωστά την γλώσσα πληκτρολογίου. Σε αυτή την περίπτωση, κάνετε τα εξής:

Ανάρτηση σχολίων στο blog

Παραπομπές δεσμών θέματος

[1] www.adaeion.gr/word/c/install_macro.html

[2] www.adaeion.gr/word/c/assign_macro_to_shortcut_or_button.html

Δημοσίευση: Τετάρτη, 10 Μαρ 2010