Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document Activate problem (Office 2000 SR-1)

    I have a template (which I set as the CustomizationContext) that opens documents by issuing a documents.open (newdocumentname) or creates new documents (and saves them).
    The problem is that if there is a document already open, the newly opened or created document does not come 'on top'.

    I've tried:

    Documents("newdocumentname").Activate

    as well as:

    For Each ldDoc in Documents
    If LCase(ldDoc.Name) = LCase("
    newdocumentname")
    ldDoc.Activate
    Exit For
    End If
    Next ldDoc


    neither of which gives the 'new' document focus.

    'preciate any help.

    Rob

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Document Activate problem (Office 2000 SR-1)

    Try

    Application.Windows("newdocumentname").Activate
    ActiveWindow.SetFocus

    The second line may not be absolutely necessary, but I think I have it there from an older version of word (97).

    Andrew C

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

    Re: Document Activate problem (Office 2000 SR-1)

    Andrew,

    This could probably be reduced to:

    Application.Windows("newdocumentname").SetFocus

    (think I learned that one from you, a while ago <img src=/S/grin.gif border=0 alt=grin width=15 height=15>)

    Gary

  4. #4
    New Lounger
    Join Date
    Aug 2001
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document Activate problem (Office 2000 SR-1)

    I've tried each of your suggestions but with the same results as before.

    Thanx,

    Rob

  5. #5
    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: Document Activate problem (Office 2000 SR-1)

    I find this to be pretty reliable:

    Dim docNew As Document
    Set docNew = Documents.Add("template.dot")
    docNew.Activate
    Set docNew = Nothing

Posting Permissions

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