Consulting

Results 1 to 5 of 5

Thread: Solved: Using trackrevisions and protectedforforms at the same time

  1. #1

    Solved: Using trackrevisions and protectedforforms at the same time

    Again, I thank all of you for providing me with informed, reliable answers.

    This time, my question has to do with using trackrevisions and protectedforforms at the same time.

    I originally developed my macro in Office 2003. I divided a document into sections, and every third section would have the following property:

    activedocument.sections(currentsectionindex).protectedforforms = true

    Finally, I would activate revision tracking.

    Activedocument.trackrevisions = true

    In office 2003, i got the results I wanted. All the sections which weren't protected for forms would allow revisions and the other sections (which had dropdown formfields) would allow formfield interaction by the user.

    Then I took this same macro to an earlier version of office, and, oh dear lord, the formfields would just disappear after I changed the value of a dropdown formfield.

    Is there any way to keep formfields from disappearing in lesser versions of office?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi,

    The key is using the argument NoReset:=True in your protection code!
    This will keep the fields from being reset/emptied out!

    A normal Protection routine for a document could look like this:[VBA]
    Option Explicit
    Sub ProtectForForms()
    With ActiveDocument
    If .ProtectionType <> wdNoProtection Then .Unprotect Password:=""
    'Do things to de document

    .Sections(1).ProtectedForForms = True
    .Sections(2).ProtectedForForms = False

    .Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
    End With
    End Sub
    [/VBA]

    Later..
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  3. #3
    Thanks for the input.

    Unfortunately, I have that line in my original code, and the formfields still disappear in Office versions 10 or less.

    Anyway, I found a weird workaround to the problem. So now, I can have dropdown formfields and track revisions at the same time in Office 10 but not in 9.

    It goes something like this:

    thisdocument.Trackrevisions = true
    thisdocument.usercontrol = true
    for each formfield in thisdocument.formfields
    formfield.helptext = ""
    next

    Don't know why, but it works.

    Again, thanks for your time.

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi,

    Glad I could help and you're welcome!
    I must admit the work arround seams strange to me...but if it works what the heck..
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  5. #5
    VBAX Regular
    Joined
    Jul 2007
    Posts
    16
    Location
    This helped me today, cheers.


Posting Permissions

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