PRB: Office Document Does Not Open When You Debug from Visual Studio .NET (823989)



The information in this article applies to:

  • Microsoft Visual Studio Tools for the Microsoft Office System version 2003

SYMPTOMS

You are developing a solution by using Microsoft Visual Studio Tools for the Microsoft Office System. Before you build your project, you change the output path of the project to a location that is outside the current project folder. When you run your project, you receive an error message when Excel or Word tries to open the document.

You receive the following message in Excel:

..\..\ExcelProject1.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.


You receive the following message in Word:

Word experienced an error trying to open the file.

CAUSE

When you create a new Office project, the Command Line Argument setting for the debugging configuration is set to a path that is relative to the original project output path. If you later change the project output path to a different folder depth, Excel or Word cannot locate the workbook or document when you run the project from the Visual Studio .NET development environment.

RESOLUTION

To resolve this problem, update the Command Line Argument setting for the debugging configuration such that it contains either an absolute path or a path that is relative to the project output.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project. The New Project dialog appears.
  3. In the list of project types, expand Microsoft Office System Projects and then select Visual Basic .NET Projects. Select Excel Workbook in the list of templates. Name the project ExcelProject1 with the location C:\, and then click OK.
  4. Create a folder named C:\Test.

    Note that this new folder is outside the folder depth of the Excel workbook project.
  5. In Solution Explorer, right-click the project, and then click Properties. Expand Configuration Properties, click Build, and then change Output Path to C:\Test. Click OK.
  6. Press the F5 key to build and run the project.

    Result: Excel reports the error that it cannot open the workbook "..\ExcelProject1.xls".
  7. Quit Microsoft Excel, to then return to Visual Studio .NET.
  8. In Solution Explorer, right-click the project, and then click Properties. Expand Configuration Properties, click Debugging, and then change the Command Line Arguments to the following relative path:

    ..\..\ExcelProject1\ExcelProject1.XLS



    Click OK.
  9. Press the F5 key to build and run the project.

    Result: Excel opens the workbook without error.

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbDeployment kbAutomation kbprb kbnofix kbBug KB823989 kbAudDeveloper