以下是引用suibianwzm20在2007-1-24 15:36:54的发言: 感谢光临!!请教如何用VBA达到如下格式
'* +++++++++++++++++++++++++++++ '* Created By SHOUROU@ExcelHome 2007-1-26 6:59:46 '仅测试于System: Windows NT Word: 11.0 Language: 2052 '№ 0145^The Code CopyIn [ThisDocument-ThisDocument]^' '* ----------------------------- Option Explicit Sub NoProblem() Dim myRange As Range, i As Paragraph, aRange As Range With ActiveDocument.Content Set myRange = .Paragraphs(1).Range '定义一个RANGE对象 myRange.SetRange 0, 1 '重设RANGE对象,为第一个文本所在区域,即试字 myRange.InsertAfter Chr(32) '试字后插入空格 myRange.SetRange myRange.End, myRange.End + 1 '卷字 myRange.InsertAfter Chr(32) myRange.SetRange 0, .Paragraphs(2).Range.End With myRange .ParagraphFormat.Alignment = wdAlignParagraphCenter '段落居中 With .Font .Size = 26 .Name = "方正舒体" .Bold = True End With .SetRange 0, 5 .Font.Underline = True End With myRange.SetRange .Paragraphs(3).Range.Start, .Paragraphs(12).Range.End '取得第三段到第十二段的十个段落区域
|