Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to transfer a ListBox to a function | Excel Programming | |||
Transfer ListBox items to a range | Excel Programming | |||
userform listbox cannot get listbox.value to transfer back to main sub | Excel Programming | |||
transfer data in listbox | Excel Programming | |||
Transfer multiple columns items form listbox to range | Excel Programming |