Microsoft KB Archive/824004

= Certain Microsoft Office Excel 2003 properties do not appear in the Object Browser or in Microsoft IntelliSense when you automate Excel by using C# =

Article ID: 824004

Article Last Modified on 2/3/2006

-

APPLIES TO


 * Microsoft Office Excel 2003
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual Studio Tools for the Microsoft Office System version 2003

-





SUMMARY
When you automate Microsoft Office Excel 2003 by using the C# programming language, certain Excel properties do not appear in the Object Browser or in Microsoft IntelliSense as you may expect. For example, the Range property of the Worksheet object and the Value property of the Range object do not appear in the Object Browser or in IntelliSense.



MORE INFORMATION
The C# programming language does not expect non-default properties to have parameters. However, some properties in the Excel object model do have parameters. Therefore, C# may access properties in the Excel object model that have parameters as methods. These properties may appear in the Object Browser and in IntelliSense prefixed with get_, or prefixed with set_, or prefixed with both get_ and set_.

The following C# code sample uses Excel properties that have the get_Range method and the set_Value method: //Start Excel, and then add a new workbook. Excel.Application oXl = new Excel.Application; Excel.Workbooks oBooks = oXl.Workbooks; Excel.Workbook oBook = oBooks.Add(System.Reflection.Missing.Value); Excel.Sheets oSheets = oBook.Sheets;

//Acquire a reference to the first worksheet in the new workbook. Excel.Worksheet oSheet = (Excel.Worksheet)oSheets[&quot;Sheet1&quot;];

//Acquire a reference to cell A1 on the worksheet, and then set the //value for the range. Excel.Range oRange = oSheet.get_Range(&quot;A1&quot;,&quot;A1&quot;); oRange.set_Value(Excel.XlRangeValueDataType.xlRangeValueDefault,   &quot;Hello World!&quot;);

//Make Excel visible, and then give the user control. oXl.Visible = true; oXl.UserControl = true;

Keywords: kbautomation kbprb kbpia KB824004

-

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

© Microsoft Corporation. All rights reserved.