Results 1 to 2 of 2
2004-10-29, 07:49 #1
- Join Date
- Jun 2004
- Gtr London, England
- 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:
If Application.Documents.count = 0 Then
'Run required function
Hope this helps anyone who comes across this problem.
2004-10-29, 20:32 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- 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.