Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2002
    Location
    Colorado
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form fields and protecting a document (Word 2000)

    I found this on a previous post #93550 from Charles Kenyon <font color=red>The tricky part is when what is filled in in textbox1 is probably - but not always - what you want in textbox5. That requires an on-exit macro for textbox1 that (1) unprotects the form, (2) updates the default text for textbox5, (3) reprotects the form without resetting the field information, and (4) moves the focus to the next field. If that is what you need, I guess write back with specifics and I or someone else will try to piece something together.</font color=red> I have been struggling with this for months. I have a form which is not a typical form. It is 17 pages long and more like an application. There are a lot of fields to input which are carried throughout the form. I have used Ask and Ref field codes, as I had to have boxes that go along with the document for the user to input into. I have also used If field codes, as there are several places that are updated depending on previous information input. I think what was mentioned in this previous post (in red) will work, but I am not an expert by any sense of the word and will need a very detailed explaination as to how to create the unprotect, update and move to next field sequence. Thanks in advance. <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

  2. #2
    Star Lounger
    Join Date
    Sep 2001
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form fields and protecting a document (Word 2000)

    Hello Smilie

    Please find attached a very short example. Basically you just have to write a very short VBA procedure and then adjust the properties of the form fields accordingly.
    I produced the example in Word 2k and it worked smoothly without removing and resetting the protection. Depending on the Word version you use you might have to remove and reset the protection.

    Hope that helps.
    hedgehog
    Attached Files Attached Files

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form fields and protecting a document (Word 2000)

    Smilie,

    What hedgehog posted will work well (in short:<pre>ActiveDocument.FormFields("To1").Result = _
    ActiveDocument.FormFields("From1").Result</pre>

    I wish I'd had a forum like this years ago when I was struggling with the concepts- it would have saved me heaps of time and effort.

    But a couple of bits:

    .It does flicker. On a large document it will be very noticable, most of all on a large doc where there are a lot of fields to update. If you can use "ref" fields back to the form field, they flicker a lot less. Also, set "screenupdating = false" before the start, ansd set back to true at the end.

    Use Hedgehog's technique only on those fields which, as you stated, are probably, but not always, in another texbox.

    Positioning to the next fill-innable field is usually automatic. If you want focus to another field elsewhere, you might have problems.

    But, for a large and complex document- particularly one which has not too many fields filled in in a number of different place, consider a userform to accept user values, and then populate the form based on results. That can be a lot cleaner to the user, and can add a lot of power to your application. You might even use a "Wizard" to add extra power.

    Also consider something like a settings file for a user. If the form involves a user's name, address and phone number (for example), it's possible (even desirable) to store those settings in something like an ini file (or even the registry if you dare). A user enters her own name/address; the next time she opens a document- even a different document- the personal information is already filled in. It can be overwritten- and if it is, the personal settings get updated.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •