For more topics on contents controls see my: Content Controls.If you want to require users to enter a value into a control when they fill out your form, you must make the field that the control is bound to a required field. I hope you have found this Microsoft Word Tips page informative and helpful. You can create your own validation module as shown above or download and use a copy of the document I used to create this tips page. That's it! With a functional OnExit event your ability to validate CC data is practically limitless. StrTemp = Left(strTemp, 5) & " " & Right(strTemp, 8) StrTemp = "(" & Left(strTemp, 3) & ") " & Right(strTemp, 8)ĮlseIf (strTemp Like "#") ThenĮlseIf (strTemp Like "(#)#-#") Then If (strTemp Like "(#) #-#") Then Exit Sub MsgBox "You did not enter a valid passcode. If Mid(strTemp, i, 1) Like Then bGate5 = TrueīValid = bGate1 And bGate2 And bGate3 And bGate4 And bGate5 If Mid(strTemp, i, 1) Like "" Then bGate4 = True If Mid(strTemp, i, 1) Like "" Then bGate3 = True If Mid(strTemp, i, 1) Like "#" Then bGate2 = True If Len(strTemp) > 5 And Len(strTemp) < 10 Then MsgBox "Please enter the SSN in ""#-#-#"" format." If Not strTemp Like "#" And Not strTemp Like "#-#-#" Then MsgBox "" & strTemp & "" & " is not a whole number. If Application.Version 50 Or Val(strTemp) Int(Val(strTemp)) Then Private Sub Document_ContentControlOnEnter(ByVal CC As ContentControl) In the standard module modRibCon2007BugKiller add the following VBA procedure: Next add a standard code module to the template VBA Project and rename the module modRibCon2007BugKiller. If you notice in the XML, I actually hid the built-in group Clipboard then built a custom Clipboard group that contains a custom Cut command and the remaining built-in commands. Note: You can't delete built-in groups from a ribbon tab or delete/hide individual commands in built-in groups. Private Sub Document_ContentControlOnEnter(ByVal ContentControl _ You can then import these modules from your storage folder into your projects as required. Using the Project Explorer pane you can right click and export each module to a folder on your PC. !! They are available in the demonstration and examples document that you can download using the link at the bottom of this tips page. The "Main" and "Accessibility" modules contain code developed by Word MVP Tony Jollans. One way to kill the bug is to import two standard code modules "Main" and "Accessibility" in each project that contains content controls and a call in the Document_ContentControlOnEntry and Document_ ContentControlOnExit event procedures as shown below: If you don't have Word 2010/2013, you simply have to kill the bug. Fortunately it has been resolved in Word 2010. Microsoft has failed miserably in resolving this issue and support Word 2007 users. This requirement makes serious validation of content controls entries using the OnExit event practically impossible!! This has been an issue since the application was released nearly 10 years ago. Things will continue to work as long as the Home tab is not the active tab. This time before you click CC1, click the "Developer" tab. The bug is associated with the active state of the Home tab and the presence of the "Cut" command in the Clipboard group of that tab.Ĭlose and reopen the document again. When you reopened the document the "Home" tab is active ("Developer" tab is no long the active tab). What's going on?!! You simply entered CC1 but the Exit event appeared to fire. You will see the appropriate message box display as expected.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |