Sub 宏1()
Dim str As String, i As Integer, j As Inte来自ger
j = 0
str = Application.ActiveDocument.Paragraphs(1).Range.Text
For i = 1 To Len(str)
If Mid(str, i, 1) = " " Then
Else
Exit For
End If
j = j + 1
Next
str = Right(str, Len(str) - j)
Application.ActiveDocument.Paragraphs(1).Range.Text = str
Application.ActiveDocument.Paragraphs(1).***.select
selection.***.name = "黑体"
Selection.Font.Size = 18
Selection.Font.Bold = wdToggle
Selec损tion.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub追问 : 高手!
能不能在您提供的代码后再加上正文设置代码?
正文(即第二段以后)格式:每段首行缩进2字符,字体为“仿宋-GB2312",字号为“小三”,每段首行是:一 二三四五六七八九十或(一)(二)(三)(四)(五)(六)(七)(八)(九)(十)或1 2 3 4 5 6 7 8 9 10等字符要加粗
万分期待
追答 : Sub test()
With Application.ActiveDocument
Dim i, pcount As Integer, astr As String
pcount = .Paragraphs.Count
For i = 2 To pcount
astr = Left(.Paragraphs(i).Range.Text, 1)
Select Case astr
Case "1" To "9", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"
.Paragraphs(i).Range.Select
Selection.MoveLeft (1)
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Bold = True
Case "("
If Mid(.Paragraphs(i).Range.Text, 3, 1) = ")" Then
Select Case Mid(ActiveDocument.Paragraphs(i).Range.Text, 2, 1)
Case "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"
.Paragraphs(i).Range.Select
Selection.MoveLeft (1)
Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
Selection.Font.Bold = True
End Select
End If
End Select
Next
.Paragraphs(2).Range.Select
End With
With Selection
.MoveLeft (1)
.EndKey Unit:=wdStory, Extend:=wdExtend
.Font.Size = 15
.ParagraphFormat.CharacterUnitFirstLineIndent = 2
.***.Name = "仿宋-GB2312"
End With
End Sub
追问 : 您编写的题目格式代码与正文格式代码分开是可以用的,我需要把两段代码合在一起,敬请赐教,十分感谢
追答 : 去 VBE 里面导入即可。
test.bas大小:1.41K 已经过百度安全检测,放心下载点击下载下载量:5