Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jun 2004
    Location
    Gtr London, England
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening a document through Windows Explorer (Office 2003)

    Thought I would share this information !!

    If you have a template stored in StartUp (Microsoft Word 2003) and you run an AutoExec function, when opening a document through Windows Explorer (when Word is not open) you will receive an error "The command cannot be performed because a dialog box is open. Click OK, and then close open dialog boxes to continue". (This error does not occur in Microsoft Word XP). Microsoft solution is to remove the template from StartUp, or open documents through Word - this, I did not feel, was an appropriate solution.

    After investigation, I have found that if you place the below code within the AutoExec function, this will resolve the error:

    Sub AutoExec()

    If Application.Documents.count = 0 Then
    Documents.Add DocumentType:=wdNewBlankDocument
    End If

    'Run required function

    End Sub

    Hope this helps anyone who comes across this problem.

    Regards
    Jack

  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: Opening a document through Windows Explorer (O

    You might want to create an object reference (Set docTemp = Documents.Add) to that blank document and close it (docTemp.Close wdDoNotSaveChanges) after you run the required code, unless you don't mind having it around.

Posting Permissions

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