Microsoft KB Archive/828087

= Microsoft Visual Studio Tools for the Microsoft Office System Readme =

Article ID: 828087

Article Last Modified on 2/3/2006

-

APPLIES TO


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

-



This article contains the text of Readme.htm that is included with Microsoft Visual Studio Tools for the Microsoft Office System.



Microsoft Visual Studio Tools for the Microsoft Office System Readme
This Readme contains important installation instructions and last-minute notes from the Microsoft Visual Studio Tools for the Microsoft Office System product team.

For the latest information on developing solutions using Microsoft Office, see the Microsoft Office Developer Center at the Web address http://msdn.microsoft.com/office.

This Readme contains the following sections:
 * Installing Visual Studio Tools for the Microsoft Office System
 * Troubleshooting Setup
 * Uninstalling Visual Studio Tools for the Microsoft Office System
 * Troubleshooting Development
 * Last-Minute Changes
 * Office Development Samples
 * Where to Find More Information
 * Installing MSDE from the Office 2003 Installation Media
 * Installing Internet Information Services (IIS)

Installing Visual Studio Tools for the Microsoft Office System
Important: Read the prerequisites and the order of installation very carefully. If you install the required products in a different order, you might not be able to use Visual Studio Tools for Office successfully.

Prerequisites for the development computer
The following software is required to install Microsoft Visual Studio Tools for Office:
 * One of the following:
 * Microsoft Visual Basic .NET 2003 Standard.
 * Microsoft Visual Studio .NET 2003 Professional.
 * Microsoft Visual Studio .NET 2003 Enterprise Developer.
 * Microsoft Visual Studio .NET 2003 Enterprise Architect.
 * The Visual Basic language and/or the Visual C# language, which can be installed with Visual Studio .NET.
 * The MSDN Library installed during Visual Basic .NET or Visual Studio .NET Setup, or during an update using Add or Remove Programs (required for installing the Help content).
 * Microsoft Office Professional Edition 2003.

Optional components for samples

The following components are required for some of the sample applications included in the online Help:
 * Microsoft Internet Information Services (IIS), installed with Microsoft Windows XP or Microsoft Windows 2000.
 * Microsoft SQL Server Desktop Engine (MSDE) installed from the Office 2003 installation media. The sample Office solution database setup scripts assume that MSDE is installed on the local host.

There are no additional hardware or system requirements beyond those specified by Visual Studio .NET 2003 and Microsoft Office 2003.

Order of installation for the development computer

 * 1) The software required to use Visual Studio Tools for Office must be installed in this order: (Optional) Install Microsoft Internet Information Services (IIS) from your Microsoft Windows XP or Microsoft Windows 2000 installation media (IIS is required by some of the sample Office solutions). For more information, see Installing Internet Information Services (IIS).
 * 2) Install Visual Basic .NET 2003 Standard or Visual Studio .NET 2003. Include the MSDN Library and the Visual Basic and/or Visual C# language.
 * 3) Install Microsoft Office Professional Edition 2003. Include Microsoft Office Word 2003 and/or Microsoft Office Excel 2003.
 * 4) (Optional) Install Microsoft SQL Server Desktop Engine (MSDE) from the Office 2003 installation media (required by some of the sample Office solutions). For more information, see Installing MSDE from the Office 2003 Installation Media.
 * 5) Install Visual Studio Tools for Office.

Prerequisites and order of installation for end-user computers Each computer to which you deploy business solutions that are developed with Visual Studio Tools for Office must be set up with these components in this order:  Install the Microsoft .NET Framework 1.1, which is available from the How to Get the .NET Framework 1.1 Web site, and on the Visual Studio .NET 2003 CDs. Install one of the following Microsoft Office products, and include the primary interop assemblies (PIAs) in the installation:  Microsoft Office Professional Edition 2003. Microsoft Office Word 2003 (Stand-alone edition). Microsoft Office Excel 2003 (Stand-alone edition). 

For managed code extensions to run properly on end-user computers, the Office 2003 PIAs referenced by your managed code extension should be installed to the local computer or marked as Install on first use. The state of the PIAs after installation depends on the Office installation option you choose:
 * Complete installation: PIAs are installed on the local computer.
 * Typical installation: PIAs are marked Install on first use and are installed on demand when your document that references a managed code extension is opened in the application. Note that PIA installation on first use might be silent; in this case, when the document opens in Word or Excel and the PIA installation occurs, no dialog box appears and no change to the end user's mouse pointer occurs during the installation. However, end users might receive a dialog box if Setup needs access to the original installation media (CDs or network location) for the installation to complete.
 * Minimum installation: PIAs are not installed or marked Install on first use.

If you perform a Minimum installation of your Office product, you can add the PIAs through Office maintenance mode Setup. If the .NET Framework 1.1 has been installed on the end user's computer, the PIAs will appear in Office Setup as .NET Programmability Support features under the appropriate applications. For more information, see &quot;How to: Install Office Primary Interop Assemblies&quot; in Visual Studio Tools for Office Help.

return to top

-

Troubleshooting Setup
These are some possible considerations when you install Visual Studio Tools for the Microsoft Office System. If you have trouble during Setup, look in the log file that is created in the computer's Temp directory to see which steps have succeeded or failed.

To check the log file
 * 1) On the Start menu, click Run.
 * 2) Type %temp%.
 * 3) Press ENTER.
 * 4) Open the file VSTO.LOG using Notepad or some other text reader.

Problem with Windows Installer package error
If you try to install Visual Studio Tools for Office and are not an administrator on the computer, the following message appears:

Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor.

You must have administrator privileges on the computer to install Visual Studio Tools for Office. Log on as an administrator and run Setup again.

Some projects are not installed
Setup will only install projects for the languages you have installed (Visual Basic .NET and/or C#). If you do not have both languages, you will see this message at the end of the installation process:

These projects will not be installed because Setup did not detect <Language> on your computer.

Even if you see this message, Setup will install projects for the language you do have on your computer. If you want to install projects for both Visual Basic .NET and C#, you must install the missing language and then run Visual Studio Tools for Office Setup again.

Text Is hidden in the Setup wizard
If your monitor is set to use High Contrast, the text in the Setup wizard will not be visible.
 * 1) To view the text in the Setup wizard Open the Control Panel, choose Accessibility Options, and then click the Display tab.
 * 2) Clear the Use High Contrast option.
 * 3) Click OK.
 * 4) Run Visual Studio Tools for Office Setup again.

Visual Studio Tools for Office Help does not appear in the Help collection
Visual Studio Tools for Office Help is integrated with Visual Studio .NET Help. It is installed during Visual Studio Tools for Office Setup if you have the MSDN Library that is included with Visual Studio .NET 2003 on your computer before running Visual Studio Tools for Office Setup. The Help is also included in the July 2003 and later MSDN updates. If you have the April 2003 MSDN update installed when you install Visual Studio Tools for Office, the Help will not install. In this case, install the July 2003 MSDN update to get the Visual Studio Tools for Office Help.

The language version of Visual Studio Tools for Office must match the Visual Studio .NET language version
If the language versions do not match, the following message appears:

Setup has detected language mismatch between this package and Visual Studio. Please obtain appropriate language version before trying again.

The language version of Visual Studio Tools for Office Setup must match the language of the installed version of Visual Studio .NET. For example, if you have an English version of Visual Studio .NET, you must install the English version of Visual Studio Tools for Office. If you have multiple language versions of Visual Studio .NET installed on the same computer, you can install all corresponding language versions of Visual Studio Tools for Office.

return to top

-

Uninstalling Visual Studio Tools for the Microsoft Office System
Use Add or Remove Programs to uninstall Visual Studio Tools for Office.

To remove Visual Studio Tools for Office using Add or Remove Programs
 * 1) Click Start, and then click Control Panel.
 * 2) Choose Add or Remove Programs.
 * 3) Select Microsoft Visual Studio Tools for the Microsoft Office System in the Currently installed programs list.
 * 4) Click Remove.

Note All assemblies that were granted full trust will retain full trust in your security policy after Visual Studio Tools for Office is uninstalled. If you want to remove all policy changes made by Visual Studio Tools for Office, delete the Office_Projects code group from the User policy level using either the Microsoft .NET 1.1 Framework Configuration tool or the Code Access Security Policy tool (Caspol.exe).

For more information, see &quot;How to: Remove Permissions from Folders and Assemblies&quot; in Visual Studio Tools for Office Help. Also, if you installed the Visual Studio Tools for Office Help files, those files will remain in the Visual Studio .NET Help collection.

To learn more about using Add or Remove Programs, see Windows Help and Support.

return to the top

-

Troubleshooting development
These are some areas to consider when developing with Visual Studio Tools for the Microsoft Office System.

Custom properties are corrupted
Several causes for the following error are documented in the Help topic &quot;Troubleshooting in Office at Run Time,&quot; but one possible cause was omitted from the topic.

The assembly name or assembly link location properties in are corrupted. Contact your administrator or the author of this document for further assistance.

This message also appears if a document or workbook that is part of an Office project is opened before the project has been built. For example, if you create an Office project using a new or existing document or workbook, and then use Word or Excel to open the document or workbook before you build the project, this message appears. In this case, it means that the custom property _AssemblyName0 has not yet been added to the document or workbook because the assembly does not yet exist. To fix the problem, close the open document, build your project, and then open the document or workbook.

Some events are not raised when using C#
Office objects that have a method and an event with the same name have been split into two objects in the Office primary interop assemblies: a core object with all the properties and methods, and an event object that contains events with names that conflict with a property or method. These event objects use the naming convention _Event. If you do not see an event that you expect, cast to the _Event interface.

For example, there is an Activate event and an Activate method for a Workbook. To handle this event, use WorkbookEvents_Event instead of Workbook.

Create member variables in the declarations section: private Excel.Workbook wkbk; private Excel.WorkbookEvents_Event wbEvents; private Excel.WorkbookEvents_ActivateEventHandler activateEvent; Wire the event in _Startup: wbEvents = (Excel.WorkbookEvents_Event)wkbk;

activateEvent = new Excel.WorkbookEvents_ActivateEventHandler(ThisWorkbook_Activate); wbEvents.Activate += activateEvent; Write an event handler: protected void ThisWorkbook_Activate {   // Your code goes here } You must cast to WorkbookEvents_Event because Excel.Workbook.Activate returns the Activate method and not the Activate event.

As an alternative, you can cast the object to its corresponding event interface in _Startup: ((Excel.WorkbookEvents_Event)(thisWorkbook)).Activate += new Excel.WorkbookEvents_ActivateEventHandler(ThisWorkbook_Activate); Then write an event handler for your code: protected void ThisWorkbook_Activate {   // Your code goes here }

Excel and Word quit unexpectedly when an unhandled exception occurs on a modeless form
If Excel or Word quits unexpectedly after a user triggers an event on a modeless form, check to see if there are any places where unhandled exceptions could be raised in the code. Add error handling to prevent possible loss of data.

For more information, see &quot;Threading Support in Office&quot; in Visual Studio Tools for Office Help.

Close method causes Word and Excel to quit unexpectedly
When you call the Close method of the Excel Workbook object or the Word Document object from a modeless form, the application might quit unexpectedly. All open documents or workbooks will close and data might be lost. If Microsoft Office Outlook uses Word as its e-mail editor, all open e-mail messages might also close. This might also occur if you display Windows Forms or message boxes while handling the AppDomain.DomainUnload event.

To work around this problem, do not call the Close method from a modeless form or in an event for a modeless form. Instead:
 * Use modal forms (for example by using form.ShowDialog instead of .Show) if you must close the document from the form.
 * If you must use a modeless form, ensure that the modeless form is closed and that your form references are completely destroyed before attempting to close the document or workbook. For example:

Dim myForm as SomeModelessForm Sub Open myForm = new SomeModelessForm ' Show form modelessly. myForm.Show End Sub

Sub ForceShutdown ' Completely close the form if it is still running. ' Note that hiding the form might not work by itself. If (Not myForm Is Nothing) Then myForm.Close myForm.Dispose myForm = Nothing End If  ThisDocument.Close End Sub For more information, see &quot;Threading Support in Office&quot; in Visual Studio Tools for Office Help.

Document opens in design mode at run time
When you host an ActiveX control on a Word document, the Word document will open in design mode if your Visual Basic for Applications (VBA) macro security is set to high and the VBA project is not digitally signed. To correct this problem, modify your project to initialize the private Boolean variable, toggleActiveXControls, to true (toggleActiveXControls is included in the project templates). This will cause the ActiveX control to toggle out of design mode when the document is opened.

Excel COM calls might fail on some client locales
Your Excel applications can be distributed to client machines with differing user locales. Under certain conditions, this can result in run-time or data conversion errors. To prevent these errors and ensure consistent functionality across locales, you must follow specific development guidelines.

For more information, see “Globalization and Localization of Office Solutions” in Visual Studio Tools for Office Help.

Full trust is not granted automatically to projects created in a network location
If you create a project and specify a network location for the document, you see a dialog box asking if you want to grant full trust to the assembly. However, even if you click Yes to grant full trust, you will not have sufficient permissions to run your project. An administrator must set security policy to trust the assembly and the document at the Machine level before the project will run. For more information, see &quot;You have specified a network location for your document and chosen to trust the assembly location by leaving the option selected on the Security Settings tab of the Microsoft Office Project Wizard&quot; in the Visual Studio Tools for Office Help.

Events are not raised in documents hosted in other documents or ActiveX containers
Office documents contained in other documents using OLE might not raise events when they are activated or opened. Likewise, if an Office document is hosted in some ActiveX containers, it might not raise events. The only ActiveX container that is supported for hosting documents with managed code extensions is Microsoft Internet Explorer 6.x.

If you open an Office document in Internet Explorer 6.x, the behavior for events raised in your managed code extension will be the same as those raised in a VBA project when the document is hosted in Internet Explorer. Due to the nature of ActiveX document hosting, some commands in the Excel or Word applications will be unavailable. Similarly, certain events are expected not to be raised when a document or workbook is contained in an ActiveX document host such as Internet Explorer (for example: in Word, mail merge events and Window events such as WindowActivate are not available; in Excel, you cannot cancel the close with the BeforeClose event handler).

Normal.dot becomes corrupted or increases size unexpectedly
If you frequently use the Stop Debugger command in Visual Studio .NET to end debugging of your Word projects, you might experience problems with the Normal.dot template. To minimize this possibility, use Detach All to end debugging instead of using Stop Debugger, and then quit Word through the Word user interface using the normal procedures.

Primary interop assemblies should not be included in Setup projects
You must manually exclude the Office primary interop assemblies referenced by your solution when you create a deployment project. End users must have Office PIAs installed from the original Office installation media in the global assembly cache (GAC) on their computers before using your solution. If your solution deploys additional copies of the PIAs, it might cause problems on end-user computers. For more information, see &quot;How to: Install Office Primary Interop Assemblies&quot; in Visual Studio Tools for Office Help.

return to the top

-

Excel Workbook projects still work after saving as templates
There is no Excel Template project among the Microsoft Office 2003 projects. However, if you create an Excel Workbook project with managed code extensions, and then save the workbook as a Template (*.xlt), the template can be used to create new workbooks that point to the same managed assembly.

Security Settings option for the project can be changed
When you create a project, the Microsoft Office Project Wizard includes a Security Settings tab that enables you to select whether you want Visual Studio .NET to grant location-based full trust to your assembly at build time. By default, this option is selected so that full trust is granted. You can change the selection later (after the Wizard has finished and at any time while you develop your project) by changing an attribute in the .vbproj or .csproj file for the project.

To change your Security Settings option  Open the .vbproj or .csproj file for the project.</li> Find the UserProperties node.</li> Add or remove the attribute called TrustedAssembly. <ul>  To grant full trust at build time, add the TrustedAssembly attribute to the UserProperties node and set it to the path to the assembly. For example: <UserProperties OfficeDocumentPath = &quot;.\PROJECT1.XLS&quot; OfficeProjectType = &quot;XLS&quot; OfficeProject = &quot;true&quot; TrustedAssembly = &quot;C:\projects\project1\project1_bin\project1.dll&quot; /> </li> To stop granting full trust at build time, remove the TrustedAssembly attribute.</li></ul> </li></ol>

return to the top

-

Office development samples
Sample solutions that you can open in Visual Studio .NET are included in Visual Studio Tools for Office Help. In the Contents window, they are located in the Samples and Walkthroughs node under the Programming with Office node. You can also look in the Visual Studio .NET index under Samples, Automating Excel and Samples, Automating Word. Each sample page includes step-by-step instructions for building and running the sample.

Some of the samples require a Microsoft SQL Server Desktop Engine (MSDE) database. A script and data files are supplied with the sample to create the database automatically.

Excel sample database does not install from default location
To install the database for some of the Excel samples, you must run a setup script (setup.bat). If the path to the database setup script contains a space, the database is not created, and the command prompt window disappears. The following error appears in database.log, which is located in <pre class="fixed_text"> \Documents and Settings\ \Local Settings\Temp:

XML parsing error: Invalid at the top level of the document.

To correct this problem:
 * 1) Click Load Sample Solution or Copy All Files in the sample topic. A dialog box appears asking you to select a location for the sample files.
 * 2) Select the root directory, or a directory that has no spaces in the path. The sample files are copied to a subdirectory of the location you select: \Samples\Office Projects\
 * 3) Move the ExcelSampleDatabase folder from the .\Samples\Office Projects\ folder up two levels to the .\Samples folder, so that it is no longer under the Office Projects directory.
 * 4) Run setup.bat in the ExcelSampleDatabase folder to create the sample database.

The following samples use the Excel sample database:
 * Excel Worksheet Using ADO.NET Sample (ExcelReadWriteADO)
 * Excel Worksheet with Custom Text Sample (ExcelReadCustomUser)
 * Excel Worksheet Using a Windows Form Sample (ExcelReadWinForm)

Excel samples might return an error when run on Windows 2000
The following error message might appear in the database.log file when you run setup.bat for the Excel sample database:

Failed to load Msxml2.dll

This error message might appear when you run the Estimates sample:

Object reference not set to an instance of an object.

If your computer is running a Windows 2000 operating system and you have installed MSDE SP3 or SP3a, your computer might not have the file MSXML2.DLL, which is required for some of the samples to run successfully.

To correct this problem, install and register MSXML2.DLL. See the following article in the Microsoft Knowledge Base for details on how you can obtain MSXML2.dll:

../823490 FIX: MSXML 2.6 Is Not Redistributed with SQL Server MSDE SP3 or SP3a

Database connections might return an error
When you run the samples that use a database, you might see this message:

SQL Server does not exist or access denied

If the TCP/IP protocol is not enabled for your SQL Server installation, you will be unable to access your SQL Server with the name localhost, and the error will appear. To correct this problem, change the server name in the ADO.NET connection to either (local) or the name of your server.

For example, a connection string such as the following: dbConn = New SqlConnection(&quot;Integrated Security=SSPI;&quot; & _    &quot;Initial Catalog=ExcelSample;Data Source=localhost&quot;) Must be changed to: dbConn = New SqlConnection(&quot;Integrated Security=SSPI;&quot; & _    &quot;Initial Catalog=ExcelSample;Data Source=(local)&quot;) The following samples reference SQL Server as localhost in an ADO.NET connection string:
 * Excel Worksheet Using ADO.NET Sample (ExcelReadWriteADO)
 * Excel Worksheet with Custom Text Sample (ExcelReadCustomUser)
 * Excel Worksheet Using a Windows Form Sample (ExcelReadWinForm)
 * Estimates Sample

Estimates sample topic might show error messages
When you open the Estimates Sample topic, you might see this message:

'children' is null or not an object. The Sample Viewer is unable to find this sample information. Please check your help installation.

This message is shown erroneously; there is no problem with the sample. This message might appear several times. Click OK each time. When the message stops appearing, you can work with the Estimates sample as usual.

return to the top

-

Visual Studio Tools for Office Help
During Setup, Visual Studio Tools for Office Help is integrated with Visual Studio .NET Help if you have the February 2003 MSDN Library on your computer before running Visual Studio Tools for Office Setup. The February 2003 MSDN Library ships with Visual Studio .NET 2003. If you have the July 2003 or later MSDN Library on your computer, Visual Studio Tools for Office Help is included in the MSDN Library node.

To find the Visual Studio Tools for Office Help in the integrated Visual Studio .NET Help collection
 * 1) In Visual Studio .NET, open the Help menu and then click Contents.
 * 2) In the Contents window, expand the Visual Studio .NET node.
 * 3) Expand the Visual Basic and Visual C# node.
 * 4) Expand the Programming with Office node, which contains all the Visual Studio Tools for Office Help.

To find the Visual Studio Tools for Office Help in the July 2003 or later MSDN Library


 * 1) In Visual Studio .NET, open the Help menu and then click Contents.
 * 2) In the Contents window, expand the MSDN Library - <July 2003 or later> node.
 * 3) Expand the .NET Development node.
 * 4) Expand the Visual Studio .NET node.
 * 5) Expand the Product Documentation node.
 * 6) Expand the Visual Basic and Visual C# node.
 * 7) Expand the Programming with Office node, which contains all the Visual Studio Tools for Office Help.

Searching for Help

In the Search Results window in Visual Studio .NET, the Location for Visual Studio Tools for Office Help appears as Office Programming Concepts.

Visual Studio Tools for Office newsgroup
Browse to this newsgroup using a reader such as Microsoft Outlook Express, or click the link to open a Web-based reader:

http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.vsnet.vstools.office&lang=en&cr=US

return to the top

Installing MSDE from the Office 2003 installation media
Some of the Office Development samples included with Visual Studio Tools for Office have database setup scripts that assume that Microsoft SQL Server Desktop Engine (MSDE) is installed on the local host.

MSDE is included on the Office 2003 installation media. It cannot be installed using Add or Remove Programs after you have installed Office 2003. To install MSDE, you must have your original installation media.

To Install MSDE from the Office 2003 installation media
 * 1) In the same Office installation folder as Setup.exe, find the subfolder MSDE2000. This folder contains the installation components for MSDE.
 * 2) For setup information, see SQL Server Books Online. The database engine documentation in the SQL Server Books Online also applies to MSDE 2000. SQL Server Books Online covers installation, database creation, administration, troubleshooting, and application development for all versions of the SQL Server 2000 database engine.
 * 3) Restart the computer after installing MSDE to configure and start the SQL Server services.

return to the top

-

Installing Internet Information Services (IIS)
Some of the Office Development samples included with Visual Studio Tools for Office include Web services that require Internet Information Services (IIS).

To install IIS on Windows 2000 or Windows XP
 * 1) Disconnect from the network, or make sure that you have a firewall installed and running.
 * 2) For Windows 2000, on the Start menu, choose Settings, and then choose Control Panel.

For Windows XP and later, on the Start menu, choose Control Panel.
 * 1) In Control Panel, choose Add or Remove Programs and then choose Add/Remove Windows Components.
 * 2) In the Windows Components Wizard, select Internet Information Services (IIS) from the Components list.
 * 3) Click Next to begin installation.
 * 4) After installation is complete, stop the IIS service.
 * 5) Download updates from Windows Update (http://www.windowsupdate.com).
 * 6) Restart if necessary, and start the IIS service.
 * 7) Return to Add or Remove Programs.
 * 8) Select the Visual Studio .NET product you have installed, and then choose Change.
 * 9) Reinstall the Visual Studio .NET product.

return to the top

-

''© Microsoft Corporation. All rights reserved.''

Keywords: kbreadme KB828087

-

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

© Microsoft Corporation. All rights reserved.