Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-17-2021, 04:06 AM
gmayor's Avatar
gmayor gmayor is offline Listbox to select field name from data Windows 10 Listbox to select field name from data Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Do you mean like

Code:
Private Sub UserForm_Initialize()
Dim lngFld As Long
    With ActiveDocument.MailMerge.DataSource
        ListBox1.Clear
        For lngFld = 1 To .FieldNames.Count
            ListBox1.AddItem .FieldNames(lngFld)
        Next
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
listbox



Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox to select field name from data Yet another Multi-Select Listbox in Userform question Javir Word VBA 4 09-24-2019 01:01 AM
How to filter data before it is pulled into combobox/listbox AND remove data from listbox Izzii0x Excel Programming 8 05-24-2019 07:25 AM
Add-In creates ListBox from XLS, but data not saved in ppt barbet PowerPoint 0 05-26-2016 02:30 AM
How to use an ActiveX Control to insert a multi select listbox in Word marksm33 Word 2 01-29-2014 05:21 PM
Listbox to select field name from data Multi-select listbox help gvibe@hotmail.com Word VBA 1 07-19-2013 10:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft