Title Field in Summary tab

R

Rick

I am not a programmer but must develop a macro that verifies a user has
filled out the Title field under the Summary tab in the Properties dialog
box. Every time a user saves the document, it must display the dialog box if
the title field is blank. This is for Word 2007. Any help at all would be
appreciated.
 
D

Doug Robbins - Word MVP

You could do this by creating the following macro in a template that you
save in the Word Startup folder.

Sub FileSaveAs()
Dim strTitle As String
If Trim(ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)) = "" Then
strTitle = InputBox("Enter the Title of the Document.", "Document
Title")
If Trim(strTitle) = "" Then
MsgBox "You must enter a Title for the Document. Otherwise, your
document will not be saved."
Exit Sub
End If
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = strTitle
End If
End Sub

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
R

Rick

Doug

Thanks so much, that seems to have done the trick.
--
Rick


Doug Robbins - Word MVP said:
You could do this by creating the following macro in a template that you
save in the Word Startup folder.

Sub FileSaveAs()
Dim strTitle As String
If Trim(ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle)) = "" Then
strTitle = InputBox("Enter the Title of the Document.", "Document
Title")
If Trim(strTitle) = "" Then
MsgBox "You must enter a Title for the Document. Otherwise, your
document will not be saved."
Exit Sub
End If
ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = strTitle
End If
End Sub

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top