|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
楼主:的确,在页脚区域输入任何文字都是在每页显示页脚文字,我想到另一个方法:就是不设置页脚,在页脚区域(但不要进入页眉页脚)上面浮动画一个文本框,在文本框中显示“一七七”这些文字即可,应该不影响页眉页脚页码显示,我已初步成功编程完毕一个小宏,如果你会用宏,请试试吧!如果不会用宏,请另寻他法。
- Sub aaaa汉字页码()
- '注意:文档至少有 3 页,再试用此宏!最好将光标放到第一页!
- '算法:在页脚区域画一文本框,最好是全部文稿完毕后,用宏临时设置之!(光标定位在任意页开始编号!)
- Dim i As Long, j As String, k As Long, g As String, v As Long, s As String, x As String, y As Long
- i = 174 '此行语句以后可以删除!
- Do
- y = y + 1
- i = i + 1
- ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 90#, 774#, 423#, 54.6).Select
- Selection.ShapeRange.TextFrame.TextRange.Select
- Selection.Collapse
- Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
- Selection.Font.Bold = True
- Selection.Font.Size = 22
-
- ' MsgBox "i=" & "[" & i & "]"
- 'i=175 j=一七五
- v = Len(Str(i)) - 1
- ' MsgBox "v=" & v
- s = Str(i)
- s = Val(s)
-
- ' MsgBox "s=" & "[" & s & "]"
- For k = 1 To v
- x = Mid(s, k, 1)
- ' MsgBox "x=" & x
-
- '翻译
- If x = "1" Then
- j = "一"
- ElseIf x = "2" Then
- j = "二"
- ElseIf x = "3" Then
- j = "三"
- ElseIf x = "4" Then
- j = "四"
- ElseIf x = "5" Then
- j = "五"
- ElseIf x = "6" Then
- j = "六"
- ElseIf x = "7" Then
- j = "七"
- ElseIf x = "8" Then
- j = "八"
- ElseIf x = "9" Then
- j = "九"
- ElseIf x = "0" Then
- j = "○" '此零乃是符号,不是真正的汉字 GBK 的零,自己网络找找吧!
- End If
- g = g & j
- ' MsgBox "g=" & g
- Next k
-
- j = g
- Selection.TypeText Text:=j
-
- Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
- Selection.Font.Color = wdColorRed
-
- Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:="" '光标定位到下一页
- g = "" '清零
- Loop Until y = 3 '假设有 3 页,如果有 100页,请将 3 为 100
- End Sub
复制代码 |
|