博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用word宏循环查找
阅读量:4120 次
发布时间:2019-05-25

本文共 798 字,大约阅读时间需要 2 分钟。

  1. Sub EditFindLoopExample()
  2. 'This example inserts "Tip: " at the beginning of
  3. ' every paragraph formatted with the Heading 3 style.
  4.     With ActiveDocument.Content.Find
  5.         .ClearFormatting
  6.         .Style = wdStyleHeading3
  7.         'The Do...Loop statement repeats a series of
  8.         ' actions each time this style is found.
  9.         Do While .Execute(Forward:=True, Format:=True) = True
  10.                 With .Parent
  11.                     'If the found text is the last
  12.                     ' paragraph in the document...
  13.                     If .End = ActiveDocument.Content.End Then
  14.                         .StartOf Unit:=wdParagraph, Extend:=wdMove
  15.                         .InsertAfter "Tip: "
  16.                         Exit Do
  17.                     'If the found text is *not* the last
  18.                     ' paragraph in the document...
  19.                     Else
  20.                         .StartOf Unit:=wdParagraph, Extend:=wdMove
  21.                         .InsertAfter "Tip: "
  22.                         .Move Unit:=wdParagraph, Count:=1
  23.                     End If
  24.                 End With
  25.         'Goes back to the beginning of the Do...Loop statement.
  26.         Loop
  27.     End With
  28. End Sub

转载地址:http://kwipi.baihongyu.com/

你可能感兴趣的文章
设计模式中英文汇总分类
查看>>
WPF实现蜘蛛纸牌游戏
查看>>
单例模式
查看>>
工厂方法模式
查看>>
模板方法模式
查看>>
数据结构之队列、栈
查看>>
数据结构之树
查看>>
数据结构之二叉树
查看>>
二叉树非递归遍历算法思悟
查看>>
红黑树算法思悟
查看>>
从山寨Spring中学习Spring IOC原理-自动装配注解
查看>>
实例区别BeanFactory和FactoryBean
查看>>
Spring后置处理器BeanPostProcessor的应用
查看>>
Spring框架的ImportSelector到底可以干嘛
查看>>
Mysql中下划线问题
查看>>
微信小程序中使用npm过程中提示:npm WARN saveError ENOENT: no such file or directory
查看>>
Xcode 11 报错,提示libstdc++.6 缺失,解决方案
查看>>
idea的安装以及简单使用
查看>>
Windows mysql 安装
查看>>
python循环语句与C语言的区别
查看>>