openoffice --替换文本的宏
Sub Main
Dim mBritishWords(5) As String
Dim mUSWords(5) As String
Dim n As Long
Dim oDocument As Object
Dim oReplace As Object
mBritishWords() = Array("colour", "neighbour", "centre", _
"behaviour", "metre", "through")
mUSWords() = Array("color", "neighbor", "center", _
"behavior", "meter", "thru")
oDocument = ThisComponent
oReplace = oDocument.createReplaceDescriptor
For n = lbound(mBritishWords()) To ubound(mBritishWords())
oReplace.SearchString = mBritishWords(n)
oReplace.ReplaceString = mUSWords(n)
oDocument.replaceAll(oReplace)
Next n
End Sub