The generated classes in projects that target the. NET Framework 4 or later, the types in the Visual Studio Tools for Office runtime listed above are interfaces, instead of classes. NET Framework 3.5, the generated classes in the projects derive from the following classes in the Visual Studio Tools for Office runtime: In document-level projects that target the.
Update code that uses instances of the generated classes in document-level projects () įor more information, see Extend Word documents and Excel workbooks in VSTO Add-ins at run time. When you access these methods in this way, you must pass the native object that you want to extend to the method. You can alternatively access these methods on the object that is returned by the Globals.Factory property. However, you must now pass the object returned by the Globals.Factory property to these methods. You can still access these methods as extension methods on Document, Workbook, Worksheet, or ListObject objects. NET Framework 4 or later, you must modify your code to access these methods in one of the following ways:
The following code example demonstrates how to use the GetVstoObject method in a Word VSTO Add-in that targets the.
When you call these methods, you do not need to pass a parameter. NET Framework 3.5, the GetVstoObject or HasVstoObject methods are available as extension methods on one of the following native objects in your project: Document, Workbook, Worksheet, or ListObject. Update code that uses the GetVstoObject and HasVstoObject methods This.Application = (Excel.Application).ExcelLocale1033Proxy.Wrap(typeof(Excel.Application), this.Application) Me.Application = CType(.ExcelLocale1033Proxy.Wrap(GetType(Excel.Application), Me.Application), Excel.Application) In the Code Editor, in the VSTO generated code region, remove or comment out the following line of code. In Solution Explorer, open the shortcut menu for ThisAddin.cs (for C#) or ThisAddin.vb (for Visual Basic), and then choose View Code. Open the project in Visual Studio, and then open Solution Explorer. To remove the reference to the ExcelLocal1033Proxy class Therefore, you must remove or comment out the line of code that references this class. This class has been removed from the portion of the Visual Studio 2010 Tools for Office runtime that's used for solutions that target the. Projects that were created by using Microsoft Visual Studio 2005 Tools for the Microsoft Office System instantiate the Excel Application object by using the .ExcelLocale1033Proxy class. Remove a reference to the ExcelLocal1033Proxy class Locate the .ExcelLocale1033Attribute and either remove it from the file or comment it out. In Visual Basic projects, you must click the Show All Files button in Solution Explorer to see the AssemblyInfo code file. Under the Properties node (for C#) or the My Project node (for Visual Basic), double-click the AssemblyInfo code file to open it in the code editor.
With the project open in Visual Studio, open Solution Explorer. For more information, see Globalization and localization of Excel solutions. NET Framework 4 and later always passes locale ID 1033 to the Excel object model, and you can no longer use this attribute to disable this behavior. The common language runtime (CLR) in the. The .ExcelLocale1033Attribute has been removed from the portion of the Visual Studio 2010 Tools for Office runtime that is used for solutions that target the. Remove the ExcelLocale1033 attribute from Excel projects
Visual Studio doesn't remove this attribute or the class reference for you. You must also remove the .ExcelLocale1033Attribute and references to the .ExcelLocale1033Proxy class from Excel projects that are retargeted to the. Generated classes in document-level projectsĬollections that derive from CollectionBase If you have an Excel or Word project that uses any of the following features, you must modify your code if the target framework is changed to the.