以下宏代码,自动清除Word当中的全部的文本框、图文框,在Word 2003当中测试通过:
Sub 删除全部文本框() '
' 删除全部文本框,保留文字 '
Dim i As Shape
For Each i In ActiveDocument.Shapes i.ConvertToFrame Next
Dim ii As Frame
For Each ii In ActiveDocument.Frames ii.Delete Next
' 取消所有框线
' ------------注:若文章当中存在有用的框线,请删除下边这几句--------- Selection.WholeStory
With Selection.ParagraphFormat
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone .Borders(wdBorderRight).LineStyle = wdLineStyleNone .Borders(wdBorderTop).LineStyle = wdLineStyleNone .Borders(wdBorderBottom).LineStyle = wdLineStyleNone .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone End With
' ------------注:若文章当中存在有用的框线,请不要执行上边这几句--------- End Sub
使用方法:
在Word中按“Alt+F11”,将上边的那一大段宏复制/粘贴进去,保存即可。 执行则按“Alt+F8”,选择“删除全部文本框”,点“执行”。
删除图文框
Sub DelFra()
Dim Fra As Frame
For Each Fra In ActiveDocument.Content.Frames Fra.Delete Next End Sub
删除文本框
Sub deltextbox()
Selection.EndKey Unit:=wdStory Dim s As Shape
For Each s In ThisDocument.Shapes
Selection.TypeText text:=s.TextFrame.TextRange.text s.Delete
Next End Sub
因篇幅问题不能全部显示,请点此查看更多更全内容