Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I have a word doc with one drop down that I would like to do as follows: If
the user drops down the box and the answer is A,b or C then it will take them to the next field to further clarify the answer and they can not move forward until that is answered. IF the answer is D or E they can skip the next field for further clarification. I hope this makes sense. Can anyone help please? -- Thanks,, Kim |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
You need to have macros set to run on exit from your Dropdown field and
mandatory text field (MyDropDown and MyText in my example), and on entry to all fields. MyText2 is the field after your mandatory text field. Option Explicit Public mstrFF As String Public Sub AOnExit() Dim oDoc As Word.Document Set oDoc = ActiveDocument With GetCurrentFF Select Case .Name Case Is = "MyDropDown" Select Case .Result Case Is = "A", "B", "C" ActiveDocument.FormFields("MyText").Enabled = True ActiveDocument.Bookmarks("MyText").Range.Fields(1) .Result.Select Case Else ActiveDocument.FormFields("MyText").Result = "" ActiveDocument.FormFields("MyText").Enabled = False ActiveDocument.Bookmarks("MyText2").Range.Fields(1 ).Result.Select End Select Case Is = "MyText" If Len(.Result) 1 Then mstrFF = .Name End If End Select End With End Sub Public Sub AOnEntry() Dim strCurrentFF As String If LenB(mstrFF) 0 Then ActiveDocument.Bookmarks(mstrFF).Range.Fields(1).R esult.Select mstrFF = vbNullString End If End Sub Public Function GetCurrentFF() As Word.FormField With Selection If .FormFields.Count = 1 Then Set GetCurrentFF = .FormFields(1) ElseIf .FormFields.Count = 0 And .Bookmarks.Count 0 Then Set GetCurrentFF = ActiveDocument.FormFields _ (.Bookmarks(.Bookmarks.Count).Name) End If End With End Function -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Kim K wrote: I have a word doc with one drop down that I would like to do as follows: If the user drops down the box and the answer is A,b or C then it will take them to the next field to further clarify the answer and they can not move forward until that is answered. IF the answer is D or E they can skip the next field for further clarification. I hope this makes sense. Can anyone help please? |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
ok I think I am seeing where this is going but I Need some help if you can
please clarify. On the drop down box, I need to bookmarkit as MYDropDown? I set the macro to run on entry as AOnOpen and on exit as AOnExit? The field that I want to go to is a Legacy Text Form Field? It is bookmarked as MyTest or My TExt2? It is set to run on Entry and exit as AOnOpen and AOnExit as well? Thanks in advance. -- Thanks,, Kim "Greg Maxey" wrote: You need to have macros set to run on exit from your Dropdown field and mandatory text field (MyDropDown and MyText in my example), and on entry to all fields. MyText2 is the field after your mandatory text field. Option Explicit Public mstrFF As String Public Sub AOnExit() Dim oDoc As Word.Document Set oDoc = ActiveDocument With GetCurrentFF Select Case .Name Case Is = "MyDropDown" Select Case .Result Case Is = "A", "B", "C" ActiveDocument.FormFields("MyText").Enabled = True ActiveDocument.Bookmarks("MyText").Range.Fields(1) .Result.Select Case Else ActiveDocument.FormFields("MyText").Result = "" ActiveDocument.FormFields("MyText").Enabled = False ActiveDocument.Bookmarks("MyText2").Range.Fields(1 ).Result.Select End Select Case Is = "MyText" If Len(.Result) 1 Then mstrFF = .Name End If End Select End With End Sub Public Sub AOnEntry() Dim strCurrentFF As String If LenB(mstrFF) 0 Then ActiveDocument.Bookmarks(mstrFF).Range.Fields(1).R esult.Select mstrFF = vbNullString End If End Sub Public Function GetCurrentFF() As Word.FormField With Selection If .FormFields.Count = 1 Then Set GetCurrentFF = .FormFields(1) ElseIf .FormFields.Count = 0 And .Bookmarks.Count 0 Then Set GetCurrentFF = ActiveDocument.FormFields _ (.Bookmarks(.Bookmarks.Count).Name) End If End With End Function -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Kim K wrote: I have a word doc with one drop down that I would like to do as follows: If the user drops down the box and the answer is A,b or C then it will take them to the next field to further clarify the answer and they can not move forward until that is answered. IF the answer is D or E they can skip the next field for further clarification. I hope this makes sense. Can anyone help please? |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Kim,
You set the AOnExit macro run on the two fields that you want to validate or act on. In this case it would be the dropdown (bookmark it as you wish and change the code accordingly) and the textfield that can't be blank if ABC is selected in the dropdown. Again, bookmark as you wish and change the code accordingly. The AOnEntry macro should be set to run on entry to all fields. The way it is set up is that if A B or C is selected the the mandatory text field is enabled. If D or E is selected then the mandatory text field is disabled and skipped and the following field is selected. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. "Kim K" wrote in message ... ok I think I am seeing where this is going but I Need some help if you can please clarify. On the drop down box, I need to bookmarkit as MYDropDown? I set the macro to run on entry as AOnOpen and on exit as AOnExit? The field that I want to go to is a Legacy Text Form Field? It is bookmarked as MyTest or My TExt2? It is set to run on Entry and exit as AOnOpen and AOnExit as well? Thanks in advance. -- Thanks,, Kim "Greg Maxey" wrote: You need to have macros set to run on exit from your Dropdown field and mandatory text field (MyDropDown and MyText in my example), and on entry to all fields. MyText2 is the field after your mandatory text field. Option Explicit Public mstrFF As String Public Sub AOnExit() Dim oDoc As Word.Document Set oDoc = ActiveDocument With GetCurrentFF Select Case .Name Case Is = "MyDropDown" Select Case .Result Case Is = "A", "B", "C" ActiveDocument.FormFields("MyText").Enabled = True ActiveDocument.Bookmarks("MyText").Range.Fields(1) .Result.Select Case Else ActiveDocument.FormFields("MyText").Result = "" ActiveDocument.FormFields("MyText").Enabled = False ActiveDocument.Bookmarks("MyText2").Range.Fields(1 ).Result.Select End Select Case Is = "MyText" If Len(.Result) 1 Then mstrFF = .Name End If End Select End With End Sub Public Sub AOnEntry() Dim strCurrentFF As String If LenB(mstrFF) 0 Then ActiveDocument.Bookmarks(mstrFF).Range.Fields(1).R esult.Select mstrFF = vbNullString End If End Sub Public Function GetCurrentFF() As Word.FormField With Selection If .FormFields.Count = 1 Then Set GetCurrentFF = .FormFields(1) ElseIf .FormFields.Count = 0 And .Bookmarks.Count 0 Then Set GetCurrentFF = ActiveDocument.FormFields _ (.Bookmarks(.Bookmarks.Count).Name) End If End With End Function -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Kim K wrote: I have a word doc with one drop down that I would like to do as follows: If the user drops down the box and the answer is A,b or C then it will take them to the next field to further clarify the answer and they can not move forward until that is answered. IF the answer is D or E they can skip the next field for further clarification. I hope this makes sense. Can anyone help please? |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Drop-down Menus won't drop down all the way | Microsoft Word Help | |||
Drop List Options Dependent On Another Drop Down List Option | Microsoft Word Help | |||
Drop down form field added but nolist in drop down | Microsoft Word Help | |||
The drop down form field is not showing drop downs. Why? | Microsoft Word Help | |||
Drop-down List where items in drop-down list hyperlink to a webpage? | New Users |