有关Word创建英语练字模板的宏
来源:互联网 发布:淘宝上买精密管犯法吗? 编辑:程序博客网 时间:2024/04/28 19:00
宏代码如下
==============================================================
Sub Add4line()
'注意录入的字体必须设置为"Times New Roman",字号为13.5号,并且每一行为一个段落
Dim i As Paragraph, MyLine As Shape, Myshape As Shape, myRange As Range, H As Integer
Dim WP As Single, PP As Single, TP As Single, lp As Single, RP As Single, n As Byte
On Error Resume Next '忽略错误
With ActiveDocument.PageSetup
WP = .PageWidth '页面宽度
lp = .LeftMargin '左页边距
RP = .RightMargin '右页边距
End With
'根据区域不同,进行设置,如果未选定内容则在全文档中进行,反之则在选定区域中进行
If Selection.Type = wdSelectionIP Then
Set myRange = ActiveDocument.Content
Else
Set myRange = Selection.Range
End If
Application.ScreenUpdating = False '关闭屏幕更新
For Each i In myRange.Paragraphs '在指定区域中循环
H = H + 1 '计数
With i.Range '对段落进行初始化设置,以达到要求
.Font.Size = 17 '字号
.Font.Name = "Rai" '字体
.Font.Color = wdColorBlueGray
.ParagraphFormat.SpaceBefore = 0 '段前为0
.ParagraphFormat.SpaceAfter = 0 '段后为0
.ParagraphFormat.LineSpacing = 23 '行距为23磅
TP = i.Range.Information(wdVerticalPositionRelativeToPage) + 5 '取得段落的垂直位置
For n = 0 To 3 '循环划直线
Set MyLine = ActiveDocument.Shapes.AddLine(lp, TP + 8 * n, WP - RP, TP + 8 * n)
MyLine.Name = "Line" & H & n
MyLine.Line.ForeColor.RGB = RGB(Red:=150, Green:=150, Blue:=150)
If n = 0 Then MyLine.Line.ForeColor.RGB = RGB(Red:=0, Green:=0, Blue:=150)
If n = 2 Then MyLine.Line.Weight = 1.5 '当N为2时的直线为1.5磅
If n = 3 Then MyLine.Line.ForeColor.RGB = RGB(Red:=150, Green:=0, Blue:=0)
Next
'组合四条直线
Set Myshape = ActiveDocument.Shapes.Range(Array _
("Line" & H & 0, "Line" & H & 1, "Line" & H & 2, "Line" & H & 3)).Group
Myshape.ZOrder msoSendBehindText '浮于文字下方
End With
Next
Application.ScreenUpdating = True '恢复屏幕更新
End Sub
- 有关Word创建英语练字模板的宏
- 有关“销售”的英语
- 练字
- 有关乒乓球的英语术语
- C#实现通过模板自动创建Word文档的方法
- C#实现通过模板自动创建Word文档的方法
- C#实现通过模板自动创建Word文档的方法
- C#实现通过模板自动创建Word文档的方法
- C#实现通过模板自动创建Word文档的方法
- 有关矩阵的模板【模板】
- 练字时的一点点体会
- 练字的诀窍有哪些?
- 练字究竟"练"的是什么?
- vb.net2005 利用创建好的WORD模板制作WORD报表
- word模板的应用
- 实习、找工作有关的英语表达方式
- 英语中与数字有关的表达方式
- 与英语有关的一个月
- 做有“小强精神”的小人物
- C++语法__explicit, export, mutable
- 在QT下编写带DLL的程序(二)
- 视频监控开发文档
- vi,gvim UTF8编码乱码解决
- 有关Word创建英语练字模板的宏
- AIX性能监控topas命令的详细解析
- Android 数据存取之Databases
- asp.net控件chart出现的错误:Chart Graphics - Unknown marker style specified.
- CentOS 5.3 快速配置VNC Server[原创]
- 基于Linux的视频传输系统
- 我用AXIOM构建服务让c#来调用的痛苦
- 动态获取 OpenFileDialog 的 Fileter 属性值
- JAVA的事务