a command button problem

  • Thread starter Thread starter NA_AB
  • Start date Start date
N

NA_AB

Range r = Connect.myApplication.ActiveCell;
Microsoft.Office.Interop.Excel.Worksheet sht =
(Microsoft.Office.Interop.Excel.Worksheet)Connect.myApplication.ActiveSheet;

Microsoft.Office.Interop.Excel.Shape btn =
sht.Shapes.AddOLEObject("Forms.CommandButton.1", Missing.Value,Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, sht.get_Range(r,
r).Left,sht.get_Range(r, r).Top,
sht.get_Range(r,r).Width, sht.get_Range(r, r).Height);


((MSForms.CommandButtonClass)btn.OLEFormat.Object).Caption = "click_me";


Why is this not working?? How to get an event handler for this button!?
 

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

Back
Top