NamedRange.AutoComplete Method
Visual Studio 2012
Gets an AutoComplete match from the list.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
The following code example demonstrates how to use the AutoComplete method. The example first sets the value of cell A1 to the string "Martha lives on a vineyard" and creates a NamedRange control in cell A2. The example then uses the AutoComplete method to obtain an AutoComplete match from the substring "Ma" and places the matching value in the NamedRange.
This example is for a document-level customization.
private void FindMarthaInTheRange() { this.Range["A1"].Value2 = "Martha lives on a vineyard"; Microsoft.Office.Tools.Excel.NamedRange namedRange1 = this.Controls.AddNamedRange(this.Range["A2"], "namedRange1"); namedRange1.AddComment("This is Martha's range."); namedRange1.Value2 = namedRange1.AutoComplete("Ma"); if (MessageBox.Show("Clear the range?", "Test", MessageBoxButtons.YesNo) == DialogResult.Yes) { namedRange1.Clear(); } }
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.