2015-07-19 54 views
0

选择列表中使用以下条件特定编号样式

Set r = ActiveDocument.Paragraphs(i).range 
If r.ListFormat.ListTemplate.ListLevels(1).NumberStyle = wdListNumberStyleLowercaseRoman Then 

我得到

运行时错误“91”:对象变量或带块变量未设置

我设法使用AscW检查为具有特定项目符号的列表创建了一个类似的宏,但这里已经浪费了一整天,仍然没有任何工作结果。

我做错了什么,怎么做对不对?

是否可以使用this table而不是wd-names的值?对于根据表格将为“2”的wdListNumberStyleLowercaseRoman。

+0

您arwe检查'ActiveDocument.Paragraphs(ⅰ).ListFormat.ListTemplate.ListLevels(1).NumberStyle'的值。你得到的错误意味着这个链接调用中的一个对象是'nothing'。很难说出它是哪一个,但通过分解声明,你可以自己弄清楚。使其更易于调试。 – GolezTrol

+1

感谢您的及时回复!事实上,对于非列表“段落”没有任何回报。我想通过你的评论和'Debug.Print'的方式来解决这个问题。 – AntonioR

回答

0

使用类的ListParagraphs代替Paragraphs将使其与WD-名称和值都正常工作。