+ -
当前位置:首页 → 问答吧 → 如何删除整篇文章中同一字体的文字

如何删除整篇文章中同一字体的文字

时间:2010-12-06

来源:互联网

如题: 如何以宏来删除整篇文章中使用同一字体(例如 Courier New)的文字? 谢谢!

作者: neanderthal   发布时间: 2010-12-06

在VBA中运行以下代码,运行即可,记住一定不能输错字体名字。
Sub delonfont()
Dim myfont As String
myfont = InputBox("请输入要删除的字体名称:")
With Selection.Find
    .ClearFormatting
    .Font.Name = myfont
    .Replacement.ClearFormatting
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll, Forward:=True, _
        Wrap:=wdFindContinue
End With


End Sub

[ 本帖最后由 hanh 于 2010-12-6 21:47 编辑 ]

作者: hanh   发布时间: 2010-12-06