Re: Why field shading persists

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The macro, as is, would unlink all the fields in the document, including the
TOC; that, too, would become plain text and wouldn't update any more. If you
don't unlink it, it will show field shading just like the form fields would.
That's why I said the macro should be used "when the document is ready" -- in
other words, just before being sent.

It would be easy to modify the macro in various ways:

- Unlink only the form fields, leaving any other fields (TOC, page numbers,
dates, etc.) intact.

- Unlink all fields except the TOC (or a short list of other field types).

To do this, I'd need to know what specific kinds of fields are in the document,
and which types you do and don't want to unlink.


On Mon, 15 Sep 2008 14:09:01 -0700, cayce <cayce@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

Yes..it is my coworkers who fill in what the macro prompts for. I'd like to
avoid the customer, who ultimately receives these files, from seeing all this
"back office" stuff.

I'll experiment with what you sent. I trust it doesn't disable the TOC in
the process.

I am deeply ignorant about Visual Basic and am tasked with supporting others
here who use the macros. I, however, did not do any of the VB design we have.
I know enough to be dangerous;)

thanks for the additional coaching Jay.
"Jay Freedman" wrote:

I think I may have misunderstood your purpose in asking. I assumed that the
form was being sent to the customer to be filled out by them and returned to
you -- that's a common scenario.

Is it the case that your coworkers are filling the fields, not the
customers? When the document is sent to the customer, would you be satisfied
if the fields were turned into plain text and were not form fields any more?

If that's the case, then add this macro to the template and provide a
toolbar button to run it when the document is ready (won't need any further
field entries):

Sub FinishForm()
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
.Unprotect
End If

.Fields.Unlink
End With
End Sub

After this runs, there won't be any field shading because there won't be any
fields.

Two things that may not be obvious:

(1) When you add macro code to a template in Word 2007, you must save it as
a macro-enabled template (.dotm instead of .dotx) or else the code will be
stripped out. All of your macro code should be in this template, not in the
"starting document" -- there should not be any .docm file in your process.
You should be using Office button > New to base new documents on the
template.

(2) When you create a new document based on a macro-enabled template, the
macro code stays in the template; the document can be saved as a .docx file.

cayce wrote:
thanks Jay for the comments. As for field shading not related to VB
code, this is new information for me. Thanks for educating me about
this.

As for field shading on the other end, I think the boilerplate
appearance of all the fields used in the document can be viewed as
impersonalization by the customer. This is the undesirable side
effect I was referring to.

thanks again for your comments.

"Jay Freedman" wrote:

cayce wrote:
Is there a way to have a Word 2007 .docx file not reveal field
shading? The files in questions start out as .docm and are later
saved as .docx.

I know you can unlink field codes by selecting all and doing a Ctrl
+ shift + F9 but since it appears the VB code is gone in a .docx, I
do not understand why the field shading persists?

The presence or absence of VB code has absolutely nothing to do with
whether field shading is shown. That's a complete non sequitur.

I am trying to give coworkers simple instruction on how to prepare a
Word 2007 file before sending to a customer. The field shading gives
a very undesirable boilerplate appearance should the recipient have
the field shading option turned on to always. The field shading
persists with the .dox file, a surprise to me.

If the recipient has the field shading option set to "always", then
presumably they expect to see field shading. Why are you trying to
override their preference? Just because you don't like it?

Has anyone ever run into this and have an easy solution?

The only "solution" is an AutoOpen macro that turns off the field
shading option when your document is opened. If you have any
consideration for the recipient, the macro will store the option's
value before turning it off, and an AutoClose macro will restore
that setting. This has many problems, though, starting with the fact
that by default Word doesn't allow unsigned macros in untrusted
locations to run at all. If you sign the macro code and it runs,
then you have the situation that fields won't be shaded in other
documents the user may have open at the same time as your document,
so you're still going against the user's preference.

My best advice is to leave it alone.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.



.



Relevant Pages

  • Re: Why field shading persists
    ... method of unlinking in that check boxes do not appear to unlink. ... This short macro will do it: ... all documents based on the template will stay unshaded -- even if the ... it will show field shading ...
    (microsoft.public.word.vba.general)
  • Re: Why field shading persists
    ... This short macro will do it: ... all documents based on the template will stay unshaded -- even if the ... it will show field shading ... I'd like to avoid the customer, ...
    (microsoft.public.word.vba.general)
  • Re: Why field shading persists
    ... "Jay Freedman" wrote: ... You can apply this macro once to the template, ... there won't be any field shading because there ...
    (microsoft.public.word.vba.general)
  • Re: Why field shading persists
    ... The following modification of the macro will unlink only form fields: ... there won't be any field shading because there ...
    (microsoft.public.word.vba.general)
  • Re: Why field shading persists
    ... It sounds like unlinking form fields is what I seek. ... don't unlink it, it will show field shading just like the form fields would. ... It would be easy to modify the macro in various ways: ...
    (microsoft.public.word.vba.general)