ListBox Loads Using Table From Another Document

N

Neal

Doug Robbins has a great post detailing how to load a listbox with client detail
stored in a table in a separate document

The post is at
http://www.google.com/groups?q=crea...=#[email protected]&rnum=1

When the the client's record is selected, it inserts the client info into the document at the specified bookmark
Each field from the table is separated with a vbcr so you end up with something like
FirstNam
LastNam
Addres
Cit
Stat
Zi

I'd like to know, if it is possible, how to display the desired client info in an "address block" format
FirstName LastNam
Addres
City, State Zi

Thanks in advance
Neal
 
P

Perry

If the FirstName is listed in column 1, LastName in column 2,
Address in 3, City in 4 and State in last column of your listbox
you could build up a concatenated string, including the paragraph
marks and place this in your document (for instance in a bookmark:
"AddressBlock")

Dim sAdd As String
With Me.ListBox1
'line with First- & LastName
sAdd = .List(.ListIndex, 0) & " " & _
.List(.ListIndex, 1) & vbCrLf
'line with Address
sAdd = sAdd & .List(.ListIndex, 2) & vbCrLf
'line with zip and state
sAdd = sAdd & .List(.ListIndex, 3) & " " & _
.List(.ListIndex, 4)
End With
'transfer to bookmark in document
ActiveDocument.Bookmarks("AddressBlock").Range = sAdd

Krgrds,
Perry

Neal said:
Doug Robbins has a great post detailing how to load a listbox with client details
stored in a table in a separate document.

The post is at:
http://www.google.com/groups?q=crea...#[email protected]&rnum=10

When the the client's record is selected, it inserts the client info into
the document at the specified bookmark.
Each field from the table is separated with a vbcr so you end up with something like:
FirstName
LastName
Address
City
State
Zip

I'd like to know, if it is possible, how to display the desired client
info in an "address block" format:
 
W

Word Heretic

G'day "Neal" <[email protected]>,

that table then has multi cols. You load col1 for listbox, use the
selected offset to dive back into the external document's table and
pick up the extra details for insertion.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Neal reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top