Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Protecting document with autofit (2002 SP3)

    On the attached document, we're trying to make it as user-friendly as possible at the same time making it error-proof. The two goals are seemingly incompatible. The document is used by various people throughout a department so we need to leave the protection on but still allow for a bit of manipulation within the document itself. As you can see the Department, Division, Sys Development, and Submitted by areas are dropdowns for them to select what they need. If we remove the protection, the dropdown menus do not function correctly. On the other hand, when we need to input more information in Project Description we need to remove the protection. It seems to be a catch-22 situation.

    What we'd like to be able to do:
    1. Protect the document at all times.
    2. Have the Project No./Title, Project Description, and Justification AUTOFIT when needed.
    3. Have the two areas containing Carryover and New Project be seen clearly so the check boxes can be seen.
    4. If needed, be able to add a row below the SYS DEVELOPMENT area.

    If anyone can help, it would be most appreciated! Thanks.
    Pooja
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting document with autofit (2002 SP3)

    2. Should be automatic. Form fields will expand/contract with the text.
    3. This must be done by unprotecting the document and changing the cell and paragraph properties of the cells with the check boxes and the text next to it. Set paragraph spacing to single instead of 6 points, add some space above and below, remove superfluous paragraph marks. Then protect the document again. (This needs to be done only once, by you, not by the end user).
    4. You need a macro for this that
    - Unprotects the document.
    - Inserts a row.
    - Protects the document again.
    You can make this macro available to the end user through a custom toolbar button and/or a keyboard shortcut.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting document with autofit (2002 SP3)

    Managed to fix problem 3! Thank you so much! Still working on 4 but I'll get it....

    Autofit (Problem 2) is still not working. I have to unprotect the document in order for that to expand so I can see everything. What I should have said is that all the text typed is there, it's just that we can't view anything after line 4 without unprotecting the document and expanding the row.

    Any suggestions?
    Pooja

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting document with autofit (2002 SP3)

    It works OK for me for Project No and for Justification. For Project Description, you must make the height of all the little cells to the right of it flexible (not fixed).

  5. #5
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting document with autofit (2002 SP3)

    I can put a lot of text in the FormFields under Project no/Title and Justification and I can see all of it, so autofit, as you call it, is working as it should. But that is not true for the text FormField under Project description. This is caused by the heigt restriction of that table row. It's set to "0.3 cm Exact". So the text is all there but cannot be viewed because the table cell isn't large enough. This is a big disadvantage of using FormFileds inside a table used for the lay-out of a form, especially in cases like this, where some cells in a row are joined / split. If you lift the height restriction on Project description row, the FormField "autofits", but that has consequences for the row above the one with Carryover!

  6. #6
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting document with autofit (2002 SP3)

    I'm having an Issue with the macro I came up with for some reason. Can anyone spot the error?

    Sub LockUnlockFormToggle()
    Dim Doc As Document
    Set Doc = ActiveDocument
    If Doc.ProtectionType <> wdNoProtection _
    Then Doc.Unprotect _
    Else: If Doc.ProtectionType = wdNoProtection _
    Then Doc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    Set Doc = Empty
    End Sub

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting document with autofit (2002 SP3)

    The main point is that the last line before End Sub should be

    Set Doc = Nothing.

    You don't need both conditions since they are mutually exclusive. I would write the macro like this:

    Sub LockUnlockFormToggle()
    Dim Doc As Document
    Set Doc = ActiveDocument
    If Doc.ProtectionType = wdNoProtection Then
    Doc.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    Else
    Doc.Unprotect
    End If
    Set Doc = Nothing
    End Sub

  8. #8
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting document with autofit (2002 SP3)

    Great! Thanks. Is there also an easy way to combine this macro with the one to insert the row? I currently have two separate macros for this...

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting document with autofit (2002 SP3)

    I wouldn't use the toggle macro for this. You may assume that the document is protected when you run the macro to insert a row. It could look like this:

    Sub InsertRow()
    With ActiveDocument
    .Unprotect
    .Tables(9).Rows(.Tables(9).Rows.Count - 1).Range.Copy
    .Tables(9).Rows(.Tables(9).Rows.Count).Range.Paste
    .Protect Type:=wdAllowOnlyFormFields, NoReset:=True
    End With
    End Sub

  10. #10
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    210
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting document with autofit (2002 SP3)

    Ah! Gotcha. Thank you. New at VB coding so I'm learning as I go...

    Thank you for all your help!
    Pooja

Posting Permissions

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