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

    Active Document Not Always Visible (W2K SR1)

    I have (reasonably) successfully used the following code to ensure that the information gathered from the user by a set of procedures/forms is correctly populated into the appropriate document.

    strDocumentName = ActiveDocument.Name

    then later:

    Documents(strDocumentName).Activate

    In most instances it makes the document active and the one that is visible on the screen (in front of any other documents already open).

    However, just to ensure that all my hair is torn out, I now have two templates that, although active (as shown highlighted in the taskbar) are not visible on the screen. A previously opened document is visible to the user.

    To bring up the active but not visible document the user clicks the task bar button twice. The first time seems to deselect it the second time activates it once more and brings it to the front.

    Any ideas?
    Thanks.

  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: Active Document Not Always Visible (W2K SR1)

    Maybe you would get more reliable results with an object reference?

    Dim docX as Document
    ...
    Set docX = ActiveDocument
    ...
    docX.Activate

    The double-clicking sounds like a minimize-restore. Who knows?!

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

    Re: Active Document Not Always Visible (W2K SR1)

    Karen,

    This sounds similar to a recent thread on the VB/VBA forum - <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=vb&Number=58349&page=2& view=expanded&sb=5&o=0#Post58349>this post</A> by Andrew Cronnolly looks worth trying.

    Gary

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

    Re: Active Document Not Always Visible (W2K SR1)

    Thanks so much. Exactly what I've been looking for.

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

    Re: Active Document Not Always Visible (W2K SR1)

    I haven't tried your suggestion but this works:

    Application.Windows(docNewDoc).activate
    ActiveWindow.SetFocus

    (code posted into VB/VBA forum by Andrew Cronnolly)

Posting Permissions

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