将选定的自动编号列表更改为纯文本单词 [英] Change selected automatic numbered list to plain text in word

查看:351
本文介绍了将选定的自动编号列表更改为纯文本单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个宏,它将一些自动编号的列表转换为纯文本.我在下面找到了这个宏,可以很好地处理整个文档,但是我希望保持文档标题等仍然自动编号,只需将文档中要求的编号列表更改为纯文本即可.

I need to create a macro that will convert some automatically numbered lists to plain text. I found this macro below which will do the whole document perfectly, however I wish to keep the document titles etc still numbered automatically and just change the numbered list of requirements in the document to plain text.

Sub Auto_Format_convert_list_numbers()
'
' convert_list_numbers Macro
' Macro created 10/8/08 by WJ Shack
'
ActiveDocument.ConvertNumbersToText

End Sub

我对这个问题的想法也许是我只能对我选择的一个列表执行此操作. (当我单击编号的项目时,它会突出显示列表中的其他项目)我尝试了以下操作,但出现错误

My thoughts on the subject were perhaps I could have it only do this to a list i have selected. (When i click on one of the numbered items it kind of highlights the others in the list) I tried the following but it gets an error

Sub Auto_Format_convert_list_numbers()
'
' convert_list_numbers Macro
' Macro created 10/8/08 by WJ Shack
'
Selection.ConvertNumbersToText

End Sub

有什么建议吗? (我会自己继续思考,但是我敢肯定,由于整个文档选项是如此简单,因此必须有一种简便的方法!)

Any suggestions? (I will keep pondering it myself but i'm sure as the whole document option is so simple there must be an easy way to do this!)

推荐答案

ConvertNumbersToText方法对Selection无效,但对List类有效,因此该子项将转换ActiveDocument:

The ConvertNumbersToText method isn't valid for Selection, but does work for the List class, so this sub will convert each List in the ActiveDocument:

Sub Auto_Format_convert_list_numbers()

Set RE = CreateObject("vbscript.regexp")

'Change your pattern here
RE.Pattern = "[A-Z][A-z][0-9][0-9][-][0-9]"

For Each Lst In ActiveDocument.Lists
Set Match = RE.Execute(Lst.Range.Text)
If Match.Count Then
  Lst.ConvertNumbersToText
End If
Next    

End Sub

这篇关于将选定的自动编号列表更改为纯文本单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆