Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Word 2K crashes on File Close (SR1, Windows 2000)

    I have three sites that are running Word 2000 on workstations that have Windows 2000. One site is also a terminal server site.

    All templates are stored on the local pc and saving to a data drive on the network.

    In the startup folder are two templates. One template contains shared code for all workgroup templates, and one template contains code for printing.

    If a user is in a document based on a workgroup template and when closing the document is asked whether he/she wishes to save the document - if the user says yes, the small disk icon on the status bar pulses and then Word crashes.

    If the user first saves the document, then closes the doc there is no problem.

    Obviously many users are in the habit of simply going Close and saying Yes to the Save question.

    Any ideas?

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Karen,

    Hard to tell at a distance why that's happening; here are a couple of questions:

    Are there any AutoClose or Document_Close procedures in either the workgroup or global templates, and if so, do they contain any code that might choke if the document has not been saved?

    Do any of the templates contain any procedures that intercept built-in Word commands such as FileSave or FileClose, and if so, is there anything in there that might cause the problem?

    Gary

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Gary, The workgroup templates contain code that forms a name for the file, and then they call a public AutoSaveDoc routine on one of the global templates that uses that name and saves the document.

    After the document has been saved, code in the workgroup template then does something else, for instance in a letter it uses code on the global template to place the signoffs etc.

    Do you think I should finish with a Save command in the workgroup template, and then something that will unload all forms and clear all variables? Is there a command that will do this?

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Karen,

    It does sound like something relating to the AutoSaveDoc routine is causing a problem.

    Returning to your first message, you said that users have a problem if they try to close the document without first having saved it - is the code for naming and calling AutoSaveDoc being run at that point? And is the additional code to do things like place the signoffs, running just before the document closes? - hard to tell from the description the order in which things are taking place.

    Hard to tell what's going on without seeing the code - is it possible to post at least part of the code?

    It is a good idea to set the workgroup template to Saved ("ActiveDocument.AttachedTemplate.Saved = True" should do). Also you should always include code behind your forms to unload them when done with them - I know some people may differ and say they can be accessed more quickly subsequently if they are hidden rather than unloaded. But that raises the housekeeping issue of ensuring they are unloaded later - I don't have sample code for this as I've never done it this way. And as far as clearing variables, the general rule is that any variable that has been assigned using a Set statement, should be set to Nothing before the end of the procedure.

    Gary

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Gary,
    Documents created by the workgroup templates are automatically saved with a filename produced by the save procedure on the global template. They may have also done some work in the actual document thus created and then, instead of saving (Ctrl S) and then closing, the users are relying on Word asking if they want to save the document on Close. This is when the document crashes.

    I have attached a zip file (well, I'll try to) containing sample global and workgroup templates. The global template (the Copy of WAMaster.dot) has all the code for producing the templates and the templates are accessed with a button NewWADocuments that shows the frmDocumentSelect form. The workgroup templates, Letter and Fax, only contain layout.

    I am going to go back and use Unload when I know that all procedures should be finished. I'm not sure whether I can unload procedures on modules or only forms.

    I don't use the Set command for variables - I simply use varname = blah blah. What does the set command do that is different from this? I'll also try and clear all the variables.

    The templates in Design1.zip are a format that I have used since Word 97 (and they worked fine there).

    However, if we could solve this crashing problem it would make many people happy!

    Thanks for your help.

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

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Karen,

    Document not attached.

    You can edit your message to try to reattach.

    But if it's too big (> 10K I think) you probably can't attach it.

    One reason for losing an attachment is attaching, and then previewing- a know problem with the forum.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    try and attach that file again!
    Attached Files Attached Files

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Thanks Geoff - it was too big and I had previewed it as well. Worked the second time around.

  9. #9
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Karen,

    Sorry, no smoking gun...
    There's quite a lot going on in your code, and without setting up a test environment, I'm left with conjectures.

    In your AutoSaveDoc procedure, there are diferent branches depending on the value of strSaveType, and the save operation is handled differently. If strSaveType = "Lawbase" then that leads to an "ActiveDocument.SaveAs", while if strSaveType = "Firm", that leads to showing the FileSaveAs dialog.

    I guess I'm missing the logic of why it's done differently in the two cases; one question that comes to mind is: does the error you are getting, only occur when one branch is executed, but not the other (i.e. only with one Save method), or is it happening with both?

    Probably not related to Word crashing, but there is a lot of hiding and showing of forms, and they're not always unloaded. Probably safer to always unload them unless you're sure you're always unloading them later somewhere.

    Re: Set statements - Set statements are used to assign object variables. These can be anything from the trivial ("Set FirstPara = ActiveDocument.Paragraphs(1)" to something major such as creating a class or a new instance of an application. There actually is an example of this hiding out in the UserForm_Activate procedure for frmSaveAs:

    <pre>'get info from Lawbase
    Dim datapath As String
    If clookup Is Nothing Then
    Set clookup = New LBClientLookup
    datapath = System.PrivateProfileString("LAWBase.ini", "Defaults", "DataDirectory")
    clookup.StartDatabase datapath
    End If
    </pre>

    This should get set to Nothing ("Set clookup = Nothing") when you're done with it. BTW I expected to find an LBClientLookup class, but didn't so am unsure how this one is working - is there an LBClientLookup class module in one of the global templates?

    One last idea is: trap the document close event, and explicitly save the document again. Worth a try to see whether this might avoid the Save Document? prompt the users are getting.

    Sorry not to have anything more definitive!

    Gary

    PS: one other topic, unrelated to the main topic:

    This:

    <pre>ActiveDocument.Bookmarks("To").Select
    Selection.Text = txtAttention</pre>

    can be done more efficiently with

    <pre>ActiveDocument.Bookmarks("To").Range.Text _
    = txtAttention
    </pre>


  10. #10
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Thanks for your input Gary. Yes there are lots of forms, I will go through and ensure that every form is unloaded once I have finished with it.

    The AutoSave routine - if the savetype is Lawbase it actually can name and save the document based on preset conditions and a standard naming convention. If it isn't Lawbase it means the document is stored elsewhere, and filename and folder are only suggested.

    The code relating to Lawbase is not complete - I took most of it out because it needed a dll file otherwise it would consistently give you a crash. It is actually set to nothing in an AutoExit routine.

    I use lots of variables many of them global - do you know of anyway to clear all variables without having to list them. For some of the string variables I have been stating varname = ""

    The problem I have when users close Word and answer Yes to the "Do you want to save" question and Word crashes happens in instances where the savetype is either of the two choices - lawbase or other.

    It also happens on systems where we are not referencing the lawbase dll.

    It also happens on systems where most of the code is stored in a workgroup template - including most of the pertinent forms - and only references the global template for the final save, paths etc.

    I also experience the problem when I am working on a global template; saving before closing avoids the problem.

    I thought about changing the File Close command to issue a save, however, a user might not want to save a document so I need to give a couple of options. I'll let you know how this pans out.

  11. #11
    New Lounger
    Join Date
    Jul 2001
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Karen,

    Do your templates contain custom toolbars? If they do I may have a possible explanation, if not a solution.

    Regards,

    Jesse

  12. #12
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Jesse, Yes the templates do contain custom toolbars - mainly the global templates, but some of the workgroup templates as well.

    I have since written my own File Close procedure that asks the user whether he or she wants to save the active document and if user says "yes", saves, if "no" closes without saving and if "cancel" closes message box and goes back to document without doing anything. I have assigned all the shortcut keys that I could think of that activated either File Close or Doc Close to this procedure and so far it is working well.

    However, I really do want to find out WHY it's happening, so I'm interested in what you have to say about the toolbars.

    Cheers,

  13. #13
    New Lounger
    Join Date
    Jul 2001
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Karen,

    It has recently come to my attention that Word 2000 will crash in a couple of situations, which I believe you are experiencing.

    The setup involves a document based on a template other than "Normal" which also uses custom toolbars.

    Situation One: File/Exit

    If this document is the only document open in Word and the custom toolbar attached to the document's template is active, and the user then tries to exit Word with File/Exit without first saving and closing the document, Word will first prompt the user to save the document, and if the user selects "Yes" to save then Word saves and closes the document, but not the custom toolbar, and Word crashes.

    Situation Two: File/Close

    It there are two or more documents open in Word and the active document is setup the same as in "Situation One:" above, and the user tries to close the active document with File/Close without first saving, the user will be prompted to save, and then upon selecting "Yes" to save, Word crashes.

    In either situation if the user decides not to save the document and clicks on the "No" button then Word does not crash. In either situation if the custom toolbar is not active when the user closes the document Word does not crash.

    It appears as though Word will save and close the document, but it does not close the active custom toolbar along with the document, which leaves Word with an active toolbar which is no longer attached to any active document or template. Word apparently can't cope with this situation and so just stops responding, no error messages or anything. The user must then run the "Task Manager" to end the unresponsive Word program's suffering.

    This bug does not appear in Word 6, or Word 97, but I wonder if it appears in Word 2002, or if Microsoft fixed it. I couldn't find anything about it in the MSKB. I'm using Word 2000 SR-1, so the SR-1 update didn't fix it. Does the SP-2 update fix it? Since I haven't installed SP-2 I don't know.

    It's very easy to avoid this bug. You can either deactivate the custom toolbar before using File/Exit, or File/Close, or simply save the document before closing it so Word doesn't have to prompt you to save.

    Regards,

    Jesse

  14. #14
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Jesse,

    Interesting scenarios, and reading them definitely put a scare in me, so I hastened to try to reproduce them, but can't.

    I'm using the exact same apps as you (on my home PC), but when I try the steps you describe, Word doesn't miss a beat. And at work, we've got dozens of templates with custom toolbars, being (ab)used by thousands of users, and haven't had a report of this particular kind of crash.

    So there's likely still some other variable in these scenarios, that's causing the crashes.

    Gary

  15. #15
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word 2K crashes on File Close (SR1, Windows 2000)

    Hi Gary,
    Since replacing File Close with my own File Close procedure (that really just duplicates what Word's file close does), my users haven't had any problems (so far - I'll keep my fingers crossed thought)

Page 1 of 3 123 LastLast

Posting Permissions

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