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



The information in this article applies to:

  • Microsoft Office Excel 2003
  • Microsoft Visual C# .NET (2003)
  • 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["Sheet1"];

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

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

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbprb kbPIA kbAutomation KB824004 kbAudDeveloper