You receive an application error when you call the Documents.Open automation method

Article translations Article translations
Article ID: 216853 - View products that this article applies to.
This article was previously published under Q216853
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SYMPTOMS

A VBScript macro causes an application error in Msdev.exe when calling the Documents.Open method on a file that does not exist. This problem may occur, for example, if the file is managed by a source management system such as SourceSafe.

CAUSE

The file specified in the first Documents.Open parameter does not exist. The file may have been deleted or renamed on the local drive.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, click the following article number to view the article in the Microsoft Knowledge Base:
194022 Visual Studio 6.0 service packs, what, where, why
194295 How to tell that Visual Studio 6.0 service packs are installed

MORE INFORMATION

The Documents.Open method takes three parameters:
  • The path of the file to open.
  • The editor to use for the file.
  • A flag to open the file in read-only instead of read-write mode.
If the latter two parameters are unspecified, the method opens the file with the default editor in read-write mode.

If the file to be opened does not exist, VBScript throws a run-time exception error. The exception is normal and expected under this condition; however, Developer Studio does not handle it properly and faults internally.

Steps to reproduce the behavior

  1. Create a new macro containing these lines:
    Sub DelAFile()
       Documents.Open "MyFile.cpp",,False
    End Sub
    In this example, the macro is named "DelAFile".
  2. Create a new empty project.
  3. Run the "DelAFile" macro repeatedly until an application error occurs.

REFERENCES

For more information about macros crashing Developer Studio, click the following article number to view the article in the Microsoft Knowledge Base:
193478 FIX: Run-time macro errors cause Developer Studio to crash

Properties

Article ID: 216853 - Last Review: February 21, 2014 - Revision: 3.0
APPLIES TO
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbnosurvey kbarchive kbtshoot kbbug kbfix kbvcobj kbautomation kbvs600sp3fix KB216853

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com