Results 1 to 3 of 3

Thread: Locking Fields

  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Locking Fields

    How do you programmatically reference a field in a document or table cell in order to lock it? I want to lock one field in a document of many fields?

    This is cross-posted from the Word forum
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    JustCallMeAl
    Guest

    Re: Locking Fields

    This is just a quickly written untried bit of code.

    <pre>Sub LockSpecificField(byval vstrFieldCode as string)

    Dim fieMyField as Field

    For each fieMyField in ActiveDocument.Fields
    If fieMyField.Code = vstrFieldCode Then
    fieMyField.Locked = True
    End If ' fieMyField
    Next fieMyField

    End Sub
    </pre>


    Of course, if you have more than one Field containing vstrFieldCode then you will have to find another way. Also, fieMyField.Code may need to be massaged by using the Instr function.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Locking Fields

    Al,

    Nicely done. I haven't tried the code, but it looks like it'll do! And it just so happends that the fields in question are FILLINs, so the CODE value includes the prompt which is unique for each one. <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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