当前位置: 代码迷 >> Office >> 请教专家小弟我用word录制的宏不能运行
  详细解决方案

请教专家小弟我用word录制的宏不能运行

热度:708   发布时间:2013-02-26 00:00:00.0
请问专家我用word录制的宏不能运行
我录制了一个超找红色文字并突出显示的宏
Sub Macro1()
  Selection.Find.ClearFormatting
  With Selection.Find
  .Text = ""
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchCase = False
  .MatchWholeWord = False
  .MatchByte = True
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  End With
  Selection.Cut
End Sub
提示:运行时错误‘4605’
此方法或属性无效,因为对象为空。
调试过程显示Selection.Cut有问题

------解决方案--------------------------------------------------------
肯定为空,因为代码中根本没出现要查找红色文字的内容。运行这个代码,什么都没找到,Selection当然为空了。
  相关解决方案