ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OLEObject.GotFocus (https://www.excelbanter.com/excel-programming/367150-oleobject-gotfocus.html)

Will Morgan

OLEObject.GotFocus
 
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



All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com