Vba 需要脚本忽略MSword表-可能是语法方面的一个简单问题
我对处理表的代码有问题,特别是我希望代码忽略它们。我不希望此代码应用于表,因此我认为我应该使用“Selection.Information(wdWithInTable)=False”来清除这些内容。不幸的是,我不知道如何选择脚本当前正在使用的段落 我试着把Vba 需要脚本忽略MSword表-可能是语法方面的一个简单问题,vba,ms-word,office-2007,Vba,Ms Word,Office 2007,我对处理表的代码有问题,特别是我希望代码忽略它们。我不希望此代码应用于表,因此我认为我应该使用“Selection.Information(wdWithInTable)=False”来清除这些内容。不幸的是,我不知道如何选择脚本当前正在使用的段落 我试着把Selection.段落(I).范围.Select放在****中,但这并没有消除处理表的第一行,我不知道为什么。我不熟悉VBA和语法,所以我假设这就是问题所在 Dim prePara As Paragraph Dim curPara As Pa
Selection.段落(I).范围.Select
放在****中,但这并没有消除处理表的第一行,我不知道为什么。我不熟悉VBA和语法,所以我假设这就是问题所在
Dim prePara As Paragraph
Dim curPara As Paragraph
Dim nextPara As Paragraph
For i = 2 To ActiveDocument.Paragraphs.Count
Set prePara = ActiveDocument.Paragraphs(i - 1)
Set curPara = ActiveDocument.Paragraphs(i)
If curPara.LeftIndent <= prePara.LeftIndent And curPara.Style = "Normal" Or curPara.Style = "List Paragraph" Then
***** 'here is where I tried Selection.Paragraphs(n).Range.Select but it didn't work
If Selection.Information(wdWithInTable) = False Then
If curPara.LeftIndent < prePara.LeftIndent Then
curPara.LeftIndent = prePara.LeftIndent
End If
End If
End If
Next
a作为段落
将段落改为段落
将下一页作为段落
对于i=2到ActiveDocument.parations.Count
Set prePara=ActiveDocument.段落(i-1)
Set curPara=ActiveDocument.段落(i)
如果curPara.LeftIndent带有此语句:
Selection.Paragraphs(i).Range.Select
您正在尝试选择一个选择对象
尝试:
谢谢你帮我澄清。它起作用了,剧本实现了我的目标。
ActiveDocument.Paragraphs(i).Range.Select