Populate UserForm List Box with Paragraph Text from MS Word Range
Hi All
Seasons Greetings :-D
I am struggling with something that I thought would be close to simple... Populate a userform listbox with text from a specified range in a document. Each entry should be a single paragraph... (ideally I'd also like the paragraph number to show up; I'm using a list style).
Private Sub UserForm_Initialize() ' <<<< code in user form (UF)Dim iRng As Range ' this is defined by a bookmarkDim parra As ParagraphDim pText As StringWith ActiveDocumentSet iRng = ActiveDocument.Bookmarks("iTxt").Range ' works, the range is selectediRng.SelectFor Each parra In iRng ' <<<< No matter what I do here the code fails with an unhelpful messagepText = parra.Range.Text RefListBox.AddItem (pText)Next parraEnd WithEnd Sub
d