Sub insertAccentedChar 'By: Bill Hibbert 05/05/2007 Use and modify as you see fit, but please keep this line 'Macro to insert character with diacritical mark in OpenOffice document 'It only works in text documents; it has no error handling but there's little to go wrong 'Covers most European languages but there are known gaps in eg Slovenian, Croatian 'Di/trigraphs from eg Hungarian, Serbian etc are also missing. 'There will be other gaps, but it's very easy to modify - just edit the table 'Needs to be bound to a keypress; CTRL+SHIFT+Z works well for me 'To use, input a pair of characters, call the macro, chars are replaced by the ... '... single matching character eg becomes <é>, becomes <ñ>, etc 'The usual accent specifiers are as below but there are a few inconsistencies: 'grave=`, acute=', circumflex=^, umlaut=:, tilde=~, ring/dotted=@ 'cedilla/ogonek=,, caron=-, bar/stroke=/,dotless=!,doubleAcute=" ' is used as a modifier/negator eg to invert a question mark, or remove dot on i 'Check the table below if in doubt; modify it to suit your convenience dim xlat() xlat = Array(_ "A`","À",_ "a`","à",_ "A'","Á",_ "a'","á",_ "A^","Â",_ "a^","â",_ "A:","Ä",_ "a:","ä",_ "A~","Ã",_ "a~","ã",_ "A@","Å",_ "a@","å",_ "AE","Æ",_ "ae","æ",_ "A,","Ą",_ "a,","ą",_ "A-","Ā",_ "a-","ā",_ "C,","Ç",_ "c,","ç",_ "C'","Ć",_ "c'","ć",_ "C-","Č",_ "c-","č",_ "D=","Đ",_ "d=","ð",_ "D/","Þ",_ "d/","þ",_ "D-","Ď",_ "d-","ď",_ "E`","È",_ "e`","è",_ "E'","É",_ "e'","é",_ "E^","Ê",_ "e^","ê",_ "E:","Ë",_ "e:","ë",_ "E,","Ę",_ "e,","ę",_ "E-","Ě",_ "e-","ě",_ "G-","Ĝ",_ "g-","ĝ",_ "I`","Ì",_ "i`","ì",_ "I'","Í",_ "i'","í",_ "I^","Î",_ "i^","î",_ "I:","Ï",_ "i:","ï",_ "i!","ı",_ "I@","İ",_ "L/","Ł",_ "l/","ł",_ "L'","Ĺ",_ "l'","ĺ",_ "L-","Ľ",_ "l-","ľ",_ "N~","Ñ",_ "n~","ñ",_ "N'","Ń",_ "n'","ń",_ "N-","Ň",_ "n-","ň",_ "O`","Ò",_ "o`","ò",_ "O'","Ó",_ "o'","ó",_ "O^","Ô",_ "o^","ô",_ "O:","Ö",_ "o:","ö",_ "O~","Õ",_ "o~","õ",_ "OE","Œ",_ "oe","œ",_ "O/","Ø",_ "o/","ø",_ "O""","Ő",_ "o""","ő",_ "R-","Ř",_ "r-","ř",_ "ss","ß",_ "S'","Ś",_ "s'","ś",_ "S,","Ş",_ "s,","ş",_ "S-","Š",_ "s-","š",_ "T,","Ţ",_ "t,","ţ",_ "T-","Ť",_ "t-","ť",_ "U`","Ù",_ "u`","ù",_ "U'","Ú",_ "u'","ú",_ "U^","Û",_ "u^","û",_ "U:","Ü",_ "u:","ü",_ "U@","Ů",_ "u@","ů",_ "U""","Ű",_ "u""","ű",_ "Y'","Ý",_ "y'","ý",_ "Y:","Ÿ",_ "y:","ÿ",_ "Z'","Ź",_ "z'","ź",_ "Z@","Ż",_ "z@","ż",_ "Z-","Ž",_ "z-","ž",_ "<<","«",_ ">>","»",_ "+-","±",_ "!!","¡",_ "?!","¿",_ "c@","©",_ "r@","®",_ "o@","°",_ "mu","µ") Dim myDoc as Object Dim controller as Object Dim viewCursor as Object Dim myText as Object Dim textCursor as Object Dim aString as String ' get current document -> controller -> view cursor -> text -> text cursor myDoc = ThisComponent controller = myDoc.getCurrentController() viewCursor = controller.getViewCursor() myText = viewCursor.getText() textCursor = myText.createTextCursorByRange(viewCursor) ' select and copy two preceding characters textCursor.goLeft(2, true) aString = textCursor.getString() ' find this pair in the input array Dim i as Integer For i = 0 To uBound(xlat()) Step 2 If xlat(i) = aString Then ' found a match, so reset the old pair to the new char textCursor.setString(xlat(i+1)) Exit For End If Next i End Sub