Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 23 Sep 2008 11:06:01 -0700,    group: microsoft.public.word.vba.general        back       


Macro for drop down lists   
Hi, this may be an elementary question, but I don't have much experience 
creating macos.

I have created a form with a combination of text fields, check boxes and 
drop downs.  To make it easier for the user, I want to create a macro so that 
if they choose a location name, it automatically fills in the location 
address, and phone numbers that are in different drop downs.  But when I try 
to record a macro, it won't let me pick from a drop down.  Am I missing a 
step 
here?  I think it may be easier to program in Excel, but this is a Word 
form.  I have read some previous entries on this site and it looks like I may 
have to use programming language.  If so, how do I do that and what is it?  

Thanks in advance for the help.
date: Tue, 23 Sep 2008 11:06:01 -0700   author:   Fly Fisher

Re: Macro for drop down lists   
Fly Fisher wrote:
> Hi, this may be an elementary question, but I don't have much
> experience creating macos.
>
> I have created a form with a combination of text fields, check boxes
> and drop downs.  To make it easier for the user, I want to create a
> macro so that if they choose a location name, it automatically fills
> in the location address, and phone numbers that are in different drop
> downs.  But when I try to record a macro, it won't let me pick from a
> drop down.  Am I missing a step
> here?  I think it may be easier to program in Excel, but this is a
> Word form.  I have read some previous entries on this site and it
> looks like I may have to use programming language.  If so, how do I
> do that and what is it?
>
> Thanks in advance for the help.

You won't be able to do this with the recorder, but the programming isn't 
too difficult. Greg Maxey has a tutorial on this at 
http://gregmaxey.mvps.org/Linked_DropDown_Fields.htm.

-- 
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so 
all may benefit.
date: Tue, 23 Sep 2008 14:31:48 -0400   author:   Jay Freedman

Re: Macro for drop down lists   
Fly Fisher,

You might want to reconsider your technique.  It the location address and 
phone number is unique to the location picked then  you don't need (or want) 
the user to have to pick it from another list (they could pick wrong despite 
your best efforts).  Instead, use a onExit macro in the location dropdown to 
automatically fill in the other information at a bookmark.

Say you have a dropdown named DDLoc with the first entry "Atlanta" and the 
second "Chicago."  Place a bookmark (lets call it "Add") where the address 
needs to go.

Then use something like:

Sub DDLocOnExit()
Dim oDD As DropDown
Dim oRng As Word.Range
Set oDD = ActiveDocument.FormFields("DDLoc").DropDown
Set oRng = ActiveDocument.Bookmarks("Add").Range
ActiveDocument.Unprotect
Select Case oDD.Value
  Case 1
    oRng.Text = "123 Peachtree Street, Atlanta GA 12345"
  Case 2
    oRng.Text = "456 Central Ave, Chicago IL 12345"
End Select
ActiveDocument.Bookmarks.Add "Add", oRng
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


Fly Fisher wrote:
> Hi, this may be an elementary question, but I don't have much
> experience creating macos.
>
> I have created a form with a combination of text fields, check boxes
> and drop downs.  To make it easier for the user, I want to create a
> macro so that if they choose a location name, it automatically fills
> in the location address, and phone numbers that are in different drop
> downs.  But when I try to record a macro, it won't let me pick from a
> drop down.  Am I missing a step
> here?  I think it may be easier to program in Excel, but this is a
> Word form.  I have read some previous entries on this site and it
> looks like I may have to use programming language.  If so, how do I
> do that and what is it?
>
> Thanks in advance for the help.

-- 
Greg Maxey -  Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org

McCain/Palin '08 !!!
date: Tue, 23 Sep 2008 14:42:30 -0400   author:   Greg Maxey RrOMEOgOLF

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us