如何使这段宏循环

来源:百度知道 编辑:UC知道 时间:2024/05/15 19:31:49
Sub Macro1()
'
' Macro1 Macro
' 宏在 2008-12-16 由 USER 录制
'
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
End Sub

意思是要在每个字后加空格,因为字太多,所以要循环

Sub Insrt()
Dim i As Long
'在当前光标位置以后的所有正文中插入空格
'ActiveDocument.Characters.Count统计正文所有字符数
For i = 1 To ActiveDocument.Characters.Count
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Next
End Sub

Sub Macro1()
'
' Macro1 Macro
' 宏在 2008-12-16 由 USER 录制
'
Dim I as Integer

For I=1 to 7
Selection.TypeText Text:=" "
Selection.MoveRight Unit:=wdCharacter, Count:=1
Next I
End Sub

这样不就行了?