Skip to content

Instantly share code, notes, and snippets.

@cwmaguire
Created November 13, 2011 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwmaguire/1362716 to your computer and use it in GitHub Desktop.
Save cwmaguire/1362716 to your computer and use it in GitHub Desktop.
"String Describer" macro module for Open Office: spells out strings with character descriptions.
Option Explicit
Function GetCharNames(textToDescribe as String) As String
dim textDesc As String
dim charIdx As Long
for charIdx = 1 to len(textToDescribe)
textDesc = textDesc & GetCharDesc(Mid(textToDescribe,charIdx,1)) & " "
next
GetCharNames = textDesc
end function
Function GetCharDesc (s As String) As String
GetCharDesc = Switch(s = "a", "low-a", _
s = "b", "low-b", _
s = "c", "low-c", _
s = "d", "low-d", _
s = "e", "low-e", _
s = "f", "low-f", _
s = "g", "low-g", _
s = "h", "low-h", _
s = "i", "low-i", _
s = "j", "low-j", _
s = "k", "low-k", _
s = "l", "low-l", _
s = "m", "low-m", _
s = "n", "low-n", _
s = "o", "low-o", _
s = "p", "low-p", _
s = "q", "low-q", _
s = "r", "low-r", _
s = "s", "low-s", _
s = "t", "low-t", _
s = "u", "low-u", _
s = "v", "low-v", _
s = "w", "low-w", _
s = "x", "low-x", _
s = "y", "low-y", _
s = "z", "low-z", _
s = "A", "UP-A", _
s = "B", "UP-B", _
s = "C", "UP-C", _
s = "D", "UP-D", _
s = "E", "UP-E", _
s = "F", "UP-F", _
s = "G", "UP-G", _
s = "H", "UP-H", _
s = "I", "UP-I", _
s = "J", "UP-J", _
s = "K", "UP-K", _
s = "L", "UP-L", _
s = "M", "UP-M", _
s = "N", "UP-M", _
s = "O", "UP-O", _
s = "P", "UP-P", _
s = "Q", "UP-Q", _
s = "R", "UP-R",_
s = "S", "UP-S",_
s = "T", "UP-T",_
s = "U", "UP-U",_
s = "V", "UP-V", _
s = "W", "UP-W", _
s = "X", "UP-X", _
s = "Y", "UP-Y", _
s = "Z", "UP-Z", _
s = "1", "one", _
s = "2", "two", _
s = "3", "three", _
s = "4", "four", _
s = "5", "five", _
s = "6", "six", _
s = "7", "seven", _
s = "8", "eight", _
s = "9", "nine", _
s = "0", "zero", _
s = "!", "Exclamation", _
s = "@", "At-sign", _
s = "#", "Number-sign", _
s = "$", "Dollar-sign", _
s = "%", "Percent", _
s = "^", "hat", _
s = "&", "ampersand", _
s = "*", "star", _
s = "(", "left-paren", _
s = ")", "right-paren", _
s = "-", "dash", _
s = "_", "underscore", _
s = "+", "plus", _
s = "=", "equals", _
s = "[", "left-bracket", _
s = "]", "right-bracket", _
s = "{", "left-brace", _
s = "}", "right-brace", _
s = "|", "pipe", _
s = "\", "backslash", _
s = "`", "backtick", _
s = "~", "tilde", _
s = ":", "colon", _
s = ";", "semi-colon", _
s = "'", "single-quote", _
asc(s) = 8220, "double-quote", _
asc(s) = 8221, "double-quote", _
s = """", "double-quote", _
s = ",", "comma", _
s = ".", "period", _
s = "<", "less-than", _
s = ">", "greater-than", _
s = "/", "fwd-slash", _
s = "?", "question-mark", _
s = " ", "space")
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment