Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3269926 建立时间:2005年6月6日 |

| |
[delpih编程]word 中 vba将一标志字符换成顺序号 软件技术
吕向阳 发表于 2010/11/3 22:19:22 |
我的WORD文档中加入了很多【===】标志,在最后行文的时候要用一个vba代码将这些标志符替换成中文顺序号(这里是简单的前二十),或英文顺序号。在word2007下测试通过。Sub make_order_number()Dim I As IntegerI = 1DoSelection.HomeKey Unit:=wdStorySelection.Find.ClearFormattingSelection.Find.Replacement.ClearFormattingWith Selection.Find.Text = "【===】".Replacement.Text = dx(I).Forward = True.Wrap = wdFindContinue.Format = False.MatchCase = False.MatchWholeWord = False.MatchByte = True.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = FalseEnd WithSelection.Find.Execute Replace:=wdReplaceOneIf Selection.Find.Found ThenElseExit DoEnd IfI = I + 1LoopEnd SubFunction dx(num As Integer) As StringSelect Case numCase 1dx = "一"Case 2dx = "二"Case 3dx = "三"Case 4dx = "四"Case 5dx = "五"Case 6dx = "六"Case 7dx = "七"Case 8dx = "八"Case 9dx = "九"Case 10dx = "十"Case 11dx = "十一"Case 12dx = "十二"Case 13dx = "十三"Case 14dx = "十四"Case 15dx = "十五"Case 16dx = "十六"Case 17dx = "十七"Case 18dx = "十八"Case 19dx = "十九"Case 20dx = "二十"End SelectEnd Function |
|
|