DrTribos
asked on
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).
There is a sub to call this...
The error message is:
Run-time error '438'
Object doesn't support this property or method
When I try to debug the line UF.show is higlighted...
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 bookmark
Dim parra As Paragraph
Dim pText As String
With ActiveDocument
Set iRng = ActiveDocument.Bookmarks("iTxt").Range ' works, the range is selected
iRng.Select
For Each parra In iRng ' <<<< No matter what I do here the code fails with an unhelpful message
pText = parra.Range.Text
RefListBox.AddItem (pText)
Next parra
End With
End Sub
There is a sub to call this...
Sub myUF()
UF.Show
End Sub
The error message is:
Run-time error '438'
Object doesn't support this property or method
When I try to debug the line UF.show is higlighted...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
d