Results 1 to 7 of 7

Thread: Solved: Printing clears fields in template

  1. #1

    Question Solved: Printing clears fields in template

    This problem is probably more Windows-related than Word, but maybe anyone has a clue. Word2k automatically clears all filled-in fields in a template when you enable security. I bypassed this by creating my own button:
    [VBA] ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True [/VBA] with the noreset-setting.

    We also have a lot of code created to bypass the standard printing operation, to make sure the different templates are printed from the right tray with different printers. I also used the noreset-setting there, it's works fine. It disabled the security, processes the vba-code, prints the document and then enables the security again. But recently I encountered a few users with the following problem. When they print a template-file with the fields already filled-in (logically), the field are emptied. The fields are emptied before the security is enabled again, so it happens with the disabling of the security. I found out that the problem can be solved by deleting the users' profile ntuser.dat (we use Win2K).

    Is this really the only solution to this, or does anyone have another solution for this??

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Just a guess... but it sounds like the users default print settings (which would be applied when the user opens Word, are intefering with what you want to do. This would make sense if deleting their profile solves the issue. I wonder if it might help to put your securtiy settings macro in the open event of the document.
    K :-)

  3. #3
    I use a centralised template to suppress the fileprint and fileprintdefault actions and replace them with my own. It's been a while, I don't remember if the problem also occurs when I use the same unprotect-action without the printing, or at what exact time the fields are emptied. I've had three users with this problem so far, but none at the moment (because we deleted the profile). I'll keep the topic open for a while, hopefully (...) I'll get another call soon...

    Thanks so far.

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

    Yes the resetting off formfields is a problem <=2000 and it has been resolved >2002. (The doing it manually part (Interface <> Code)
    So with an upgrade you totaly loose this problem.

    Word 2000 has more field related issues and all are fixed with hotfixes form MS..are you up to date on you're Office updates?

    Another option could also be that the Users Normal.dot template got corrupted and that could explain the trouble as well...

    If it hapens again you might want to check the User's option and check if: Fast Save is on (This does generate a lot of problems in Word and corruptions)
    Also you might want to check if Background printing is on in Word! If so (which is normal) you might want to uncheck it and try again. (If Word has more resources available to process you might get surprising results...that would tell you something about the resources on the computer also)

    O that's right! Are you changing any of the formfield properties in you're code? (like name and stuff) This always resets a value in a formfield as well so...might want to check for stuff like that..

    Enjoy!
    _________
    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

    Angry

    I just got a call from a user that has the problem. I'll try the following:

    * Check where in the code the fields are emptied

    * Re?nstall printers
    * Delete normal.dot

    * Install SP3

    I'll let you know...

    Update 1:
    Ok, the news so far. The things I tried above, didn't help. When I remove my custom central template (for the printing) the problem doesn't exist, so it has to be the code. I'll post it here (it's a lot), I'm now stripping the code piece by piece trying to find out what part screws up...

    Update 2:
    The problem stills occurred after I stripped the complete code down to just this (pfffff, there goes my morning).

    [VBA]
    ActiveDocument.Unprotect "********"
    Dialogs(wdDialogFilePrint).Execute
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, noreset:=True, Password:="********"
    [/VBA]

    So it is the security issue with the printing. I installed SP3, that didn't help. Is there a loose patch for this??

    I just can't figure out why it just happens to this one user, out of the 600. I copied her ntuser.dat to a test-user, I was able to recreate the problem.

    The problem does NOT occur when I do this:

    [VBA]ActiveDocument.Unprotect "********"
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, noreset:=True, Password:="********"
    Dialogs(wdDialogFilePrint).Execute [/VBA]

    YESSSSSSSSSS !!!!!!
    JAAAAAAAAAA !!!!!!

    I got it.

    Strange but true.

    In the final part of the coding it:
    printed the document and then protected the document again.

    After changing this to:
    protecting the document and THEN printing it

    solved the problem!!!!!!

    scr*w you Bill Gates!!!!


  6. #6
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Great commentary!

    So what have I learned from this?
    1. Sharing your problems helps, even if you end up finding your own solution
    2. It always turns out to be the last thing on your list of things to check
    3. It's always Bill Gates' fault (he'd probably feel bad if he weren't so damn rich)
    K :-)

  7. #7
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Yes...loved reading you're comments! Goed gedaan joh!
    _________
    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)

Posting Permissions

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