Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-19-2015, 12:23 AM
gmayor's Avatar
gmayor gmayor is offline Disable Save and Save As Windows 7 64bit Disable Save and Save As Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Save and Save As Macro to save as pdf with ability to choose save as folder 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
Disable Save and Save As When I try to save an existing word doc, save as pops up and will not save... 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:07 PM.


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