Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-15-2024, 11:43 AM
gmaxey gmaxey is offline Visual Basic Code for a Required Drop Down Menu Form Field Windows 10 Visual Basic Code for a Required Drop Down Menu Form Field Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

By fields, I will assume you mean formfields. Formfield dropdowns by design can't be empty. They have to contain one of the list items that you define.



E.g., you might define "Choose Letter" as the first entry then A, B, C, D etc.


Sub ValidateFFs()
Dim oFF As FormField
For Each oFF In ActiveDocument.FormFields
Select Case oFF.Name
Case "Dropdown1"
If oFF.Result = "Choose Letter" Then
oFF.Range.Select
MsgBox "This field must have a valid selection"
Exit For
End If
Case "Text1"
'Your code for validating the Text1 field.

End Select
Next oFF
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Code for a Required Drop Down Menu Form Field Code line for adding Building Blocks to a macro in Visual Basic proking Word VBA 9 01-07-2020 10:05 AM
Activate (show) a Drop-down form field when another drop-down form field is selected from Jentis Word VBA 1 04-19-2018 09:42 PM
Word Form/ActiveX drop down menu/value in a different field AMackenzieFFCU Word VBA 1 01-14-2013 07:48 AM
Visual Basic Code for a Required Drop Down Menu Form Field Visual basic code for Word 2003 template KateAus Word VBA 4 09-09-2012 08:40 PM
Visual Basic Code for a Required Drop Down Menu Form Field How to I make text Bold in a User Form -Visual Basic gurp99 Word VBA 11 03-12-2012 04:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft