PDA

View Full Version : Restrict printing unless field occupied



donnyp02
08-04-2011, 03:02 PM
I have a word document I send out as a template. No matter what I've tried, highlighting the blanks, sending an accompanying check list, I cannot get everyone to properly fill in, or even look at, all the fields that need to be occupied.

My question is, is there a way to keep the document from printing unless certain fields(currently using Content Controls) are filled in.

Also, Whenever they save this document that is properly filled in, is there a way to automatically change the properties of the saved document to not be able to be duplicated.


Thanks in advance, you guys are the best!
Donny

gmaxey
08-04-2011, 09:03 PM
For the first question something along these lines:

Option Explicit
Sub FileSave()
On Error Resume Next
If Validate Then ActiveDocument.Save
End Sub
Sub FileSaveAs()
If Validate Then ActiveDocument.SaveAs
End Sub
Sub FilePrint()
If Validate Then ActiveDocument.PrintOut
End Sub
Function Validate() As Boolean
Dim oCC As ContentControl
Validate = True
For Each oCC In ActiveDocument.ContentControls
If oCC.ShowingPlaceholderText = True Then
MsgBox "Fill in the form and try again"
Validate = False
Exit For
End If
Next oCC
End Function

donnyp02
08-07-2011, 09:16 PM
Thanks Greg! I'm working with that.

Is there a way to make it so some of the content controls could be left blank? Or a way that you could just prompt for all the fields and it will fill itself in?

Thanks for your help!