Microsoft KB Archive/209768

= WD2000: "Cannot Find the File..." Error When You Open Word Document in Windows Explorer =

Article ID: 209768

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q209768



SYMPTOMS
If your global template (Normal.dot) contains an AutoExec macro that waits a specified period of time, when you double-click a Word document (for example, in Windows Explorer), you may receive an error message similar to the following, and the file that you double-clicked does not open:

Cannot find the file  (or one of its components). Make sure the path and filename are correct and that all required libraries are available.

is the name of the file that you are trying to open.



CAUSE
This error message may occur if your global template (Normal.dot) contains an AutoExec macro that runs a loop to wait a specified period of time.

For example, if you have an AutoExec macro in Normal.dot which loops for three minutes, you may receive the error message after the looping routine is completed, as in the following sample macro: Sub AutoExec Dim sLoadPath As String Dim theTarget as String theTarget = Timer + 180 '//delay 3 minutes Do While Timer < theTarget Loop End Sub



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

To work around this problem and programmatically a wait routine, use the OnTime method. To do this, create macros similar to the following examples.

Create the following AutoExec macro that uses the OnTime method to immediately execute another macro (CheckDocOpen) to check if a document is already open: Sub AutoExec Application.OnTime When:=Now + TimeValue("00:00:00"), _ Name:="CheckDocOpen" End Sub Create the following CheckDocOpen macro. This macro again checks if a document is open. If a document is not open, the macro waits two seconds and runs the AutoExec macro again. Sub CheckDocOpen If Documents.Count = 0 Then Application.OnTime When:=Now + TimeValue("00:00:02"), _ Name:="AutoExec" Else AutoExecReal End If End Sub Create the following AutoExecReal macro. If the CheckDocOpen macro finds an open document, it calls the AutoExecReal macro, which contains your intended macro code that runs a wait routine: Sub AutoExecReal ' Real code meant for AutoExec goes here. theTarget = Timer + 180 '//delay 3 minutes Do While Timer < theTarget Loop End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
For additional information about using a wait routine, click the article number below to view the article in the Microsoft Knowledge Base:

212667 WD2000: How to Implement a Delay in Visual Basic for Applications

For more information about the OnTime method, click Microsoft Word Help on the Help menu, type ontime in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Additional query words: vba cannot find file component double click long time wait waiting won't open doesn't

Keywords: kbbug kbnofix KB209768

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.