![]() |
#4
|
||||
|
||||
![]()
The same issue with respect to macros applies, however you can intercept the filesave and filesaveas functions in the document, by adding the following code to the document and save it from the vba editor (because you won't be able to save it from the document itself) as a macro enabled document.
It is not possible to determine whether a check box should be checked or not, nor is it possible to check that the selection in a dropdown form field is correct (unless you have default text which is not a valid result). Code:
Option Explicit Sub FileSaveAs() On Error Resume Next If DataCheck = True Then GoTo lbl_Exit Dialogs(wdDialogFileSaveAs).Show lbl_Exit: Exit Sub End Sub Sub FileSave() On Error Resume Next If DataCheck = True Then GoTo lbl_Exit ActiveDocument.Save lbl_Exit: Exit Sub End Sub Private Function DataCheck() As Boolean Dim oFF As FormField For Each oFF In ActiveDocument.FormFields If oFF.Type = wdFieldFormTextInput Then If oFF.Result = "" Then DataCheck = True MsgBox "You must complete then form before you can save it!" oFF.Select Exit For End If End If Next oFF lbl_Exit: Exit Function End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rvessio | Word VBA | 4 | 07-25-2016 12:37 PM |
Disable "do you also want to save changes to the document template?" harassalog. | wornways | Word | 30 | 06-04-2016 02:32 PM |
Disable "Save" & "Save As" & "Print" ribbon | Villalobos | Word VBA | 3 | 07-14-2014 11:37 PM |
![]() |
samanthab | Word | 3 | 01-19-2013 06:27 AM |
Word ask to save template whenever i save a derived document | jorbjo | Word | 3 | 10-04-2012 10:52 AM |