I'm trying to execute an action based on the next paragraph value with the following
If ActiveDocument.Paragraph.Next(wdParagraph).Range.Characters.Count > 1 Then
However, I think I'm not using the .Next correctly. How can I use it whithin that line of code?
The Next
method doesn't appear to be available in all versions of Word VBA. According to this site it is specific to Office 365. https://msdn.microsoft.com/en-us/vba/word-vba/articles/paragraph-next-method-word However, you are also not using it correctly. The above site shows the following syntax. Set myRange = ActiveDocument.Paragraphs(1).Next(Count:=n).Range
So, the logic is to define the paragraph where you are now ( Paragraphs(1)
) and specify that you are counting paragraphs by that same parameter. Therefore Next(wdParagraph)
isn't required to specify the subject of your count. Instead, wdParagraph
would indicate that you wish to specify the 4th paragraph from where you are (wdParagraph = 4), if you had provided that information earlier on in your syntax.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.