Excel range from event

Using the following event to get range info from Excel:

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,_xlRef ,Missing.Value,Missing.Value);

_currWS = (Excel.Worksheet)_currRng.Worksheet;

_currWB = (Excel.Workbook)_currWS.Parent;

lblWB.Text = _currWB.Name;

lblWS.Name = _currWS.Name;

lblAddress.Text = address;

}

When the 'SelectionChange' runs the get_Address method invariably returns an empty string. If I execute after the 'SelectionChange' procedure has completed I get the address I want. What am I doing wrong  

ojv




Answer this question

Excel range from event

  • Excel range from event