Range address from Excel in C#
Hope this is the right forum, if not please indicate which is.
Have implemented a SelectionChange event for Excel in C# - code below:
private void SelectionChange(Excel.Range Target)
{
_currRng = Target;
_currWS = (Excel.Worksheet)_currRng.Worksheet;
_currWB = (Excel.Workbook)_currWS.Parent;
string address =
_currRng.get_Address(Missing.Value,Missing.Value,
Excel.XlReferenceStyle.xlA1 ,Missing.Value,Missing.Value);
lblWB.Text = _currWB.Name;
lblWS.Text = _currWS.Name;
lblAddress.Text = address;
}
Invariably address comes out with an empty string ("") in the routine above.
However, if I get the address with the same statement after the
'SelectionChange' procedure has completed I get the correct address. What am
I missing?
ojv
|