我想删除当前page.but中的分区中断或分页中断-- vba代码没有work.how来对其进行建模吗?
Sub Del_sectionbreakORpagebreak()
Selection.Bookmarks("\page").Range.Select 'select current page
With Selection.Find
.ClearFormatting
.Execute FindText:="^b", Format:=True 'find section break
fnd = .Found
End With
If fnd = True Then
With Selection.Find
.ClearFormatting
.Text = "^b"
.Replacement.Text = " "
.Forward = True
.Execute Replace:=wdReplaceOne
End With
Else
With Selection.Find
.Text = Chr(12)
.Replacement.Text = ""
.Forward = True
.Execute Replace:=wdReplaceOne
End With
End If
End Sub发布于 2022-03-16 07:50:25
您不能删除自动分页。对于其他页/节间隙:
Sub Demo()
With Selection.Bookmarks("\page").Range.Characters.Last
If .Previous.Text = Chr(12) Then .Previous.Text = vbNullString
If .Text = Chr(12) Then .Text = vbNullString
End With
End Sub发布于 2022-03-17 07:12:26
Sub Del_sectionbreak()
Selection.Bookmarks("\page").Range.Select
With Selection.Find
.ClearFormatting
.Execute FindText:="^b", Format:=True
fnd = .Found
End With
If fnd = True Then
Selection.Delete
Else
With Selection.Find
.Text = Chr(12)
.Replacement.Text = vbNullString
.Forward = True
.Execute Replace:=wdReplaceOne
End With
End If
End Sub代码功能是删除当前页面中的分段或分页。
https://stackoverflow.com/questions/71491904
复制相似问题