View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Will Morgan Will Morgan is offline
external usenet poster
 
Posts: 1
Default 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