Hi,
I need to create some kind of mailmerge that links a Word doc to a single
file (Excel, Access, whatever) which contains an extensive glossary, and let
the user pick wich terms from that glossary want to include in the active doc.
Any help will be much appreciated.
MrSWF
Doug Robbins - 11 Sep 2005 11:09 GMT
I would create a userform containing a multiselect listbox that would be
populated with all of the items. The user could then select from the
listbox the items to be included. The following routine will load such a
listbox
Private Sub UserForm_Initialize()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim NoOfRecords As Long
' Open the database
Set db = OpenDatabase("D:\Access\ResidencesXP.mdb")
' Retrieve the recordset
Set rs = db.OpenRecordset("SELECT * FROM Owners")
' Determine the number of retrieved records
With rs
.MoveLast
NoOfRecords = .RecordCount
.MoveFirst
End With
' Set the number of Columns = number of Fields in recordset
ListBox1.ColumnCount = rs.Fields.Count
' Load the ListBox with the retrieved records
ListBox1.Column = rs.GetRows(NoOfRecords)
' Cleanup
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub
and to for the code to determine which items are selected, See the article
"How to find out which Items are selected in a Multi-Select ListBox" at:
http://www.word.mvps.org/FAQs/Userforms/GetMultiSelectValues.htm

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> Hi,
>
[quoted text clipped - 7 lines]
>
> MrSWF