PDA

View Full Version : List box and email



Zane Stein
08-30-2012, 07:49 PM
I'm very new to VBA, so forgive my ignorance. I'm working with Word 2010.
I've created a form the user must fill out. What I'm trying to do, once the user has finished answering the other questions on the form, to have them click on the individuals who need to get a copy of the form and have it emailed to all selected. I assumed this would entail:
1 Create a listbox with 6 names in it
2 Enable the user to click on one or more names to highlight the names they want
3 Make sure if they click a name a second time it takes the highlight off that name
4 Set it so that when they click on the module beginning CommandButton2_Click() it will send a copy of the ActiveDocument to the email address of each person in the listbox whose name has been highlighted

I am not really sure how to populate the listbox properly with the individual entries.
I've created a button successfully that will send the document to predesignated email addresses that are hard programmed into the vba script.
What I can't figure out is the proper coding to list the individuals in the listbox, and then set up a if/then statement so that when the button is clicked, it will send the document only to the selected people in the listbox.

Can anyone assist?

Thank you.

Zane

gmaxey
08-30-2012, 09:36 PM
It sounds like you already know how to send the e-mail and just need a boost populating your listbox. There is a lot of material to sift through here, but if you sift, I think you will find your way:

http://gregmaxey.mvps.org/word_tip_pages/populate_userform_listbox_or_combobox.html