Hi everyone! Haven't been in here in a while. . . I'm weak on Word VBA (Excel's my thing) and I'm in a time-sensitive bind.
I just need a VBA code frag that will step through the paragraphs of the current document, compare the first word of the current paragraph to the first word of the next paragraph (they are product numbers), and if they are the same, set the following for the current paragraph:
With .ParagraphFormat
.WidowControl = True
.KeepWithNext = True
' or select both paragraphs and set .KeepTogether = True
End With
Basically I need to make sure that successive paragraphs dealing with the same product print on the same page.
Clear as mud?
Thanks for any quick assistance you can give on this! I don't have the time to learn the whole Word object tree for this little project. . .
VBAjedi![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)
I just need a VBA code frag that will step through the paragraphs of the current document, compare the first word of the current paragraph to the first word of the next paragraph (they are product numbers), and if they are the same, set the following for the current paragraph:
With .ParagraphFormat
.WidowControl = True
.KeepWithNext = True
' or select both paragraphs and set .KeepTogether = True
End With
Basically I need to make sure that successive paragraphs dealing with the same product print on the same page.
Clear as mud?
Thanks for any quick assistance you can give on this! I don't have the time to learn the whole Word object tree for this little project. . .
VBAjedi
![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)