View Single Post
  #8  
Old April 13th, 2010, 01:14 AM posted to microsoft.public.word.tables
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default Update Fields Wreeks Havoc!

Hi Dax,

In that case, you could create an application event handler to ensure forms protection is applied before the document is printed.

For example, using the Normal.dot template:
.. in an ordinary Module in you could insert code like:
Option Explicit
Dim oAppClass As New ThisApplication

Public Sub AutoExec()
Set oAppClass.oApp = Word.Application
End Sub

.. a Class Module you could insert code like:
Option Explicit
Public WithEvents oApp As Word.Application

Private Sub oApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
If Doc.FormFields.Count 0 Then _
If Doc.ProtectionType = wdNoProtection Then _
Doc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End Sub

With the above code, unprotected documents containing formfields will be protected prior to printing, but other documents will be
left alone.

--
Cheers
macropod
[Microsoft MVP - Word]


"Dax Arroway" wrote in message ...
Yes, Doug, I believe you're right. But to be clear, the issue is not that
the form fields reset themselves when the form is "relocked" like macropod is
suggesting; but thanks for the macro anyway. It is when the form is unlocked
and left unlocked, then printed with the update fields option checked in the
Print dialog box which appears when you hit the Options button in the Print
dialog box that comes up when you go to File then Print, that resets the form
fields. (Does that even make sense??? In other words:
FilePrintOptionsUpdate Fields checkbox.)

Just wanted to make sure we're all on the same page.
--
I would give my left hand to be ambidextrous!


"Doug Robbins - Word MVP" wrote:

I think that it might have been Word XP that introduced the ability to
reprotect a form via the UI without causing the formfields to be reset. It
was definitely before Word 2007.

However, even in Word 2007, if you unprotect a document that contains
formfields into which data has been entered and you then update the fields
WITHOUT first re-applying the protection, the data will be deleted from the
formfields.

--
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

"macropod" wrote in message
...
Hi Dax,

If you switch to Word 2007, existing formfield data are preserved when you
unlock/lock a form. With earlier versions, you can preserve the existing
data by locking the form with a macro coded like:
Sub LockForm()
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Noreset:=True, _
Password:=InputBox("Form Pasword", "Protect Form")
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"Dax Arroway" wrote in message
...
Hi Doug,
Thanks for responding. F9 will work just fine. The fields are simple
text
form fields. Unfortunately the documents my company uses sometimes are
not
designed the best way and are missing things, such as entries in drop
down
menues that aren't in the dropdown menu. Sure, there's ways to fix it
but
when I'm sitting with a client filling out the form I don't have time to
update and edit forms. That said, what sometimes happens is I'll need to
unlock the locked document to make "on the fly" adjustments and if I
don't
re-lock the document all data in all form fields go away as all the form
fields get reset to blank with the Update Fields option selected in the
print
settings. A simple Undo replaces the data, fortunatly, and after I
recover
from my heart attack I can relock the document and save it and print it
appropriately. It just makes me not want to have that option selected,
and
really, the only thing thus far that I'd want that selected for to date
is to
get the field to calculate on this one document. F9 will work just fine
for
that. Thank you.
--
I would give my left hand to be ambidextrous!


"Doug Robbins - Word MVP" wrote:

You can select the field and Press F9 to update it.

However, it is perfectly normal to have the Update Fields at Print
option
set on and I do not understand the issue that you have with field data
disappearing in your other documents. What sort of fields are they.

--
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

"Dax Arroway" wrote in message
...
I've got a Word03 table with a column with simple numbers which I'm
trying
to
Sum in a cell at the bottom. By reading other posts I discovered that
one
way of doing this is to use the =Sum(Above) function and set the print
options to Update Fields upon printing to get it to calculate but
since
this
is a globally set option, it does all sorts of very scary things to
other
documents. If I have a document with feilds in it that isn't locked,
it
resets all the feilds to blanks (extremly scary when it just took me 2
hrs
to
fill out the form!). My work also has a bunch of old docs that some
"smart"
person filled with Mergefeilds (don't even get me started) which are
extremely bothersome with this option selected (but not for anyone
else
and
they all think I'm crazy!) Anyway, besides going the "Use Excel"
route to
create this document, does anyone know a way of summing a column of
simple
numbers in a word table??

Thanks in advance!
--Dax
--
I would give my left hand to be ambidextrous!