Microsoft KB Archive/823989

= PRB: Office Document Does Not Open When You Debug from Visual Studio .NET =

Article ID: 823989

Article Last Modified on 2/3/2006

-

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.



Steps to Reproduce the Behavior
 Start Visual Studio .NET 2003. On the File menu, point to New, and then click Project. The New Project dialog appears. 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. Create a folder named C:\Test.

Note that this new folder is outside the folder depth of the Excel workbook project. 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.</li> Press the F5 key to build and run the project.

Result: Excel reports the error that it cannot open the workbook &quot;..\ExcelProject1.xls&quot;.</li> Quit Microsoft Excel, to then return to Visual Studio .NET.</li> 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.</li> Press the F5 key to build and run the project.

Result: Excel opens the workbook without error.</li></ol>

Keywords: kbbug kbnofix kbautomation kbprb kbdeployment KB823989

-

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

© Microsoft Corporation. All rights reserved.