View Single Post
 
Old 02-19-2014, 03:41 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,366
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I suppose the first issue you'll need to address is: How do you propose to hide the table and prevent its deletion?

Once you've resolved that little issue, your 'UserForm_Initialize' sub can be implemented as:
Code:
Private Sub UserForm_Initialize()
   Dim Rng As Range
    Me.lb1aa.ColumnCount = 1
     'Populate the listbox.
    With ActiveDocument.Tables(#)
        For i = 2 To .Rows.Count
             'Use .AddItem property to add a new row for each record and populate column 0
             Set Rng = .Cell(i, 1).Range
             Rng.End = Rng.End - 1
            .AddItem Rng.Text
        Next i
    End With
End Sub
where # is the index number of the table you're pulling the data from.

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote