Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Dialogs not closing (Word XP /SR1)

    I'm again having a problem which I had in Word 2000 with custom dialogs not closing as expected. I have narrowed down the problem a bit and wonder if anyone has experienced it and/or found a solution.

    Each macro that we run for our forms is going to have at least 3 custom dialogs. One, the menu from which the user selects the required form; two, the dialog with fields to be completed for the header that is common to about 50% of the forms; three, the dialog with the fields that are specific to the chosen form. Often there is a fourth, which is a simple message box: a reminder to forward a copy of the document to a particular person or department.

    I can write a test macro to load and show 10 or 12 custom dialogs one after the other. They display and close in turn as the command button is hit. There is never any problem with this.

    But in the "real world", dialogs linger and pile up on screen sometimes, subsequent dialogs appearing on top of previously "closed" dialogs (which haven't really closed). If you drag the "top" dialog, it leaves a trail. This tells me that it's a resource problem. But why no resource problem in the test scenario? I'm working on a Dell P-4 workstation, 2Ghz processor, 1 Mb RAMBUS RAM, WinXP Pro. But I don't think the problem is peculiar to this PC. The problem is intermittent, but once it occurs in a session, it continues. But the test macro will always work without a problem.

    I use Documents.Add to create the document, and then selection.insertfile to insert the header that is common to most forms. It appeared for a bit that the insertfile was responsible for the problem, and I moved that to the end of the code. That seemed to do the trick for a while, but then of a sudden, the problem reappered. I re-boot frequently to avoid a problem with leaking resources.

    I can user multi-tab or multi-page forms in some cases for forms with large amounts of user-completed data. But the three dialogs I've mentioned (menu, common header, specific fields) are critical.

    Any ideas?
    Thanks,
    Richard Barrett

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Dialogs not closing (Word XP /SR1)

    In your code, do you manipulate the screen refresh/redraw properties? Could you inadvertently be turning off whatever causes Word/Windows to repaint UserForms in real time? There is a method for UserForms named something like Repaint. You could try using that here and there and see if it helps kick Windows back into gear.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Dialogs not closing (Word XP /SR1)

    Occasionally I do turn off screen update, but I haven't done so in this instance. As far as the code is concerned, the dialog is really hidden... I don't think that Repaint would help, although it's worth a try. The symptom of the "trail" when dragging the dialog that superimposes on another is indicative of low resources, but that explanation simply doesn't make sense. I have nothing running but Word (and VBA editor) and at times I can work for an hour or two and not see it happen. But then all of a sudden it does. On other occasions it happens the first time I run the macro after booting the PC.

Posting Permissions

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