LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Transfer Data from ListBox to MergeFields

Ive always found the help in this Excel Programming DG to be tremendously
valuable (and from time to time I try to offer valuable help too). Recently,
I posted a Word-based question to the Word Programming group, but only got
one response and I didnt know what to do with the advice I got so Im coming
here for help. I may, or may not, get the answer here. Lets see. Anyway,
I am currently facing a challenge to get data from a ListBox in MS Word,
which originally comes from Excel, into about 32 MergeFields in a Word
template that I created.

Everything works, with the exception of the final transferring of data from
a ListBox into several MergeFields in my Word document. The code below works
for Bookmarks, but not for MergeFields. I dont know how to create code that
takes data from a ListBox and transfers this data into the appropriate
MergeFields. The code for doing this for Bookmarks is displayed below:

Private Sub CommandButton1_Click()
Dim i As Integer, Addressee As String
Addressee = ""
For i = 1 To ListBox1.ColumnCount
ListBox1.BoundColumn = i
Addressee = Addressee & ListBox1.Value & vbCr
Next i
ActiveDocument.Bookmarks("Addressee").Range.Insert After Addressee
UserForm1.Hide
End Sub


Doug gave me this code over the summer. It works great for Bookmarks in a
Word document, but it doesnt do anything for me now that I am using
MergeFields. Some of my MergeFields are as follows:
{MERGEFIELD City \* MERGEFORMAT}
{MERGEFIELD State \* MERGEFORMAT}
{MERGEFIELD Number \* MERGEFORMAT}
€¦etc.

For a full explanation of the issue, and all related details, here is a link
to the post on the Word Programming DG:
http://www.microsoft.com/office/comm...sloc=en-us&p=1

Any help would be greatly appreciated!!

Regards,
Ryan--


--
RyGuy
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to transfer a ListBox to a function Stefan Mueller[_2_] Excel Programming 2 July 17th 07 08:15 AM
Transfer ListBox items to a range AD108 Excel Programming 2 September 10th 06 01:49 PM
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
transfer data in listbox Glen Mettler[_2_] Excel Programming 1 September 24th 04 10:44 AM
Transfer multiple columns items form listbox to range Rolo[_3_] Excel Programming 3 November 15th 03 06:50 PM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"