Code posted below: Private Sub selectRange () Dim oParagraph As Word.Paragraph Dim oRange, oStartPar As Range Dim oStyle, oParaStyle, sStartPar, sEndPar As String Dim iStartPar, iEndPar As Integer Dim x As Long ' Loop. So that's basically it I am very glad that despite being rusty at VBA, I have now sorted 153 pages of automated notes into a workable spreadsheet. Once it finds 'Heading 2', it then needs to select all subsequent paragraphs appearing before the next 'Heading 2' paragraph. If Mid(xString, 1, 12) = "- Highlight " Then Set xRange = ActiveDocument.Paragraphs(xP).Range ' I HAD TO REFRESH THE RANGE AFTER SOME MANIPULATION Set xRange = ActiveDocument.Paragraphs(xP).Range ![]() If Mid(xString, (Len(xString)) - 1, 1) = ")" Then XString = xRange ' HERE I USED STRING TO DO SOME OF THE TASKS Set xRange = ActiveDocument.Paragraphs(xP).Range ' USING THIS WAS THE KEY TO MY UNDERSTANDING HOW TO MANIPULATE SPECIFIC PARAGRAPH ONLY P RE: conditionally manipulate text in each paragraph macropod (TechnicalUser) 7 Jan 19 21:32 I will post my solution (which will make the source of the issue more transparent) (MIS) You understand my original issue very well. This way we could get an idea of what you are trying to accomplish. Re: “Everything I try fails me at some point.” It would be nice to see what have tried. Re: “My problem is not how to manipulate the text, but how to be able to do so limited to a particular paragraph” since the text is split into paragraphs, you can deal with each individual paragraph and accomplish what you need. Re: “I need to go thru each paragraph” which means this text needs to be split into separate paragraphs, which is split by either Chr(10) & Chr(13) or vbNewLine Re: “I have a plain text file.” In my book that’s just a simple text file that can be opened in Notepad, like SomeFile.txt I have not done anything in VBA for the past three years and forgot how solutions differ between word and excel. Just because this post is in VBA forum, doesn’t mean 565u is dealing with Word. The Paragraphs collection includes all the paragraphs in a selection, range, or document. ![]() I will post my working solution once it's you for your kind reply! The Paragraph object is a member of the Paragraphs collection. Confusingly, perhaps, the Outline Level of a paragraph (in Word terminology). ![]() You very much for your kind replies! They got me started and now I am sucessfully progressing in solving this. If Selection.Paragraphs(1). 1Then MsgBox.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |