OLEObject.GotFocus

W

Will Morgan

I am trying to add a GotFocus Handler to OLEObject in excel and it will
always trip and exception.

The following code snippet show how I'm handling the event. It blows at the +=


Excel._Application ExcelApp =
(Excel._Application)applicationObject;
Excel.Worksheet activeWorksheet =
(Excel.Worksheet)ExcelApp.ActiveSheet;
Excel.OLEObjects objCollection =
(Excel.OLEObjects)activeWorksheet.OLEObjects(Type.Missing);
Excel.OLEObjectEvents_GotFocusEventHandler hand = new
Excel.OLEObjectEvents_GotFocusEventHandler(objOle_GotFocus);
Excel.OLEObject objBarcode =
objCollection.Add("Barcodefactory.Barcode", null, null, null, null, null,
null, curSel.Left, curSel.Top, curSel.Width, curSel.Height);
objBarcode.GotFocus += hand;


Thanks,
Will Morgan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top