View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default a button on an excel cell

From your adjacent post I guess you mean you want a button on a sheet to
call code in your comaddin. You'd do that pretty much the same way as with
an Office.CommandBarButton. Ensure your addin has a reference to MSForms
object library and use WithEvents btn as MSForms.CommandButton.

Set c.btn = xlApp.ActiveWorkbook.Activesheet.OLEObjects(<name or
index).Object

See VBA help how to add an ActiveX button to a worksheet.

Unlike the CommandBarButton which only exposes a click event, the
CommandButton exposes a range of events as well as click.

Regards,
Peter T

"NA_AB" wrote in message
...
hey guys, just wanted to know if we can generate a button on an excel
cell!
also, if we can, how to do we handle its actions like onButtonClick( )
etc?!