#1
|
|||
|
|||
Help with a drop down in userform and variables
Hi everyone,
New to VB not looking necessarily for someone to do this for me just if there's a term or something so that I can better search Google for how to do this. Basically I have a standard Word file with a lot of docvariable fields, and then a userform where users enter text into the fields, and when hitting Ok it populates that into the Word document which is easy. I'm trying to figure out how to do an if statement I think it is. So on the word document there's a heading "Sales rep" and it has 3 docvariables on 3 rows (I'd do it on 1 if it's possible to have a variable be formatted to be multiple lines). So basically the first line the variable name is "Full Name" second line and variable is "Phone Number" and 3rd line and variable is "Email address". What I want is on the userform, a drop down that has a listing of 5 sales reps names. If the user clicks John Smith on the drop down and Saves the form, it then fills in John Smith, his number and his email. If they select a different user, it does the same with their info. I'm sure this is pretty straight forward I just wanted to find out if this was called anything in particular so I know what to search for in learning how to do this? Thanks!!! |
#2
|
|||
|
|||
Well if you are using Word 2013 and all of your users are using Word 2007 or higher then content controls (vice document variables) would, I think, be a better choice for data targets in the document.
What you need is a three column listbox contol. Put the sales rep name in column 1 (0 in control speak), the phone number in column 2 (1) and the email in column 2 (1). You can hide the contents of columns 2 and 3 (1 and 2) and only show the sales rep name in the listbox. When the user makes a selection and clicks ok then you populate the variables or content controls with the listbox column values. Lots of methods and techniques here: http://gregmaxey.com/word_tip_pages/..._combobox.html |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help, auto select drop down by another drop down value? | skrallemand | Word VBA | 3 | 09-11-2013 11:55 AM |
Find and replace using variables | jago25_98 | Word | 1 | 01-31-2012 04:30 AM |
Nesting Variables SET, LISTNUM, and REF | Wyskers | Word | 1 | 11-13-2011 05:43 AM |
changing variables in MS word - please help | McGinzo | Word | 0 | 08-24-2011 06:25 AM |
Envelopes with Document Variables | mailtobln | Word | 0 | 02-11-2009 10:48 PM |