首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 办公应用 > OFFICE教程 >

openoffice -轮换文本的宏

2013-02-19 
openoffice --替换文本的宏Sub MainDim mBritishWords(5) As StringDim mUSWords(5) As StringDim n As Lo

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


热点排行