K
Kim K
I have a macro that I am using that works like this, drop down selection has
5 choices, if choice 2 or 3 is selected then a message will pop up stating
that the next field needs further clarification and to please fill in, in
otherwards it will not allow the user to go past the next field if choice 2
or 3 is not clarified.
I can set up my document and get this in and test it - works fine. I then
build from there, adding header, footer, tables, check boxes, popup calendar
macro, list box macros, specify continuous breaks and protections, then test
All macros work except the choice 2-3 macro. It allows for bypass and does
not show pop up message.
What am I doing wrong?
This is word 07 saved in dot format for use on re is macro code I am using:
Option Explicit
Public mstrFF As String
Public Sub AOnExit()
Dim oDoc As Word.Document
Set oDoc = ActiveDocument
With GetCurrentFF
Select Case .Name
Case Is = "SchoolType"
Select Case .Result
Case Is = "Other District School", "Private School/Home Schooled"
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
DoEvents
MsgBox "Please list Other District School or Private School/Home Schooled"
ActiveDocument.Bookmarks(mstrFF).Range.Fields(1).Result.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
5 choices, if choice 2 or 3 is selected then a message will pop up stating
that the next field needs further clarification and to please fill in, in
otherwards it will not allow the user to go past the next field if choice 2
or 3 is not clarified.
I can set up my document and get this in and test it - works fine. I then
build from there, adding header, footer, tables, check boxes, popup calendar
macro, list box macros, specify continuous breaks and protections, then test
All macros work except the choice 2-3 macro. It allows for bypass and does
not show pop up message.
What am I doing wrong?
This is word 07 saved in dot format for use on re is macro code I am using:
Option Explicit
Public mstrFF As String
Public Sub AOnExit()
Dim oDoc As Word.Document
Set oDoc = ActiveDocument
With GetCurrentFF
Select Case .Name
Case Is = "SchoolType"
Select Case .Result
Case Is = "Other District School", "Private School/Home Schooled"
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
DoEvents
MsgBox "Please list Other District School or Private School/Home Schooled"
ActiveDocument.Bookmarks(mstrFF).Range.Fields(1).Result.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