Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts
    I have a custom dialog box (user form) on which there's a command button that displays another user form. This secondary form is smaller in size and collects information that is subordinate to the main user form, and is used infrequently.

    When I work on this at home, the 2nd, smaller dialog box displays on top of the first, centered on it... as I would expect and as I intent. At the office, the 2nd dialog box displays after switching to a different document, should there be another document open. The first dialog box is no longer visible. When I close the 2nd, smaller dialog box, the first reappears and things move along normally.

    I've seen situations where displaying a user form causes the document to flip to another document. Although this is temporary, users wonder what's going on. Is there a trick to ensuring that user form 2 displays on top of user form 1?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    In which document are the userforms stored? If document A is the active document, and you run code (including displaying a userform) that resides in document B, sometimes document B is activated. I don't think I've ever seen the reverse happening.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts
    The user form (and VBA code) is in a global template (which is not open for editing).

    I have dual monitors on the office PC where the problem occurs. I thought perhaps that might contribute to the problem, and I disabled the secondary device. That did solve the problem... for one day only. The next day, it did not resolve the issue.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You might use a public variable of type Document and set it to the active document when the first userform is opened, then set the active document to the variable when the second form is opened. Rather kludgy, but I don't know of a more elegant way.

  5. #5
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts
    Thanks. I typically do that anyway because I've found that documents "flip" under a user form often enough to make that extra bit of code worthwhile. I activate the intended document after the .Show method, which means Ill be sure to be where I want to be when the dialog box closes. I suppose I could make the variable public in scope and activate the document in the user form's Activate event. I'll give that a try... I'm not sure that the code will affect the document while a user form is active.

Posting Permissions

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