Suppressing FORMTEXT default text when printing

G

Guest

In a template I have setup multiple FORMTEXT fields where default text is
displayed to the user offering a suggestion as to how to complete the field.
Not all fields need to be completed. When the user prints the filled in
document, the field values are printed for the ones they completed, but also
the default text for the fields they did not complete. How can I suppress
the printing of the default values?
 
G

Graham Mayor

Instead of using default text, use help text and use a pop-up message called
by macro on entry to the first field to draw attention to the help messages
in the status bar e.g.

Sub PopUpAdvice()
Set Balloon = Assistant.NewBalloon
With Balloon
.Text = "Refer to status line at bottom of screen for field entry
details"
.Button = msoButtonSetOK
.Animation = msoAnimationBeginSpeaking
.Show
End With
End Sub

or even

Sub PopUpAdvice
MsgBox "Refer to status line at bottom of screen for field entry details"
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Jay Freedman

Hi fontman,

I agree with Graham that help text is better than default text, but if you
want to continue with default text anyway, you can use macros to clear the
fields when the user prints. You need to intercept the FilePrint command
(for the menu item and Ctrl+P) and the FilePriintDefault command (for the
toolbar button). Each of those macros should call a subroutine that cycles
through the text fields and clears them if they contain the default text.

If the default text for all the form fields starts the same way, for example
"Enter ...", and if this isn't likely to be the start of the user's entry,
then the test can be simple like the one below. If not, you can use a Select
Case statement where the case labels are the names of thetext form fields,
and each case tests for a specific default text.

Public Sub FilePrint()
ClearDefaults
Dialogs(wdDialogFilePrint).Show
End Sub

Public Sub FilePrintDefault()
ClearDefaults
ActiveDocument.PrintOut Background:=False
End Sub

Private Sub ClearDefaults()
' remove default text from
' text form fields before printing

Dim myField As FormField

For Each myField In ActiveDocument.FormFields
With myField
If .Type = wdFieldFormTextInput Then
If Left$(.Result, 6) = "Enter " Then
.TextInput.Default = ""
.TextInput.Clear
End If
End If
End With
Next myField
End Sub

If you want the default text to be returned to the document after printing,
you can use ActiveDocument.Undo. A nice trick for this is to insert a
bookmark in the document before you start clearing fields, print, then run
Undo in a While loop until the bookmark no longer exists.
 

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