LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default to add a button to the active excel cell! here's the way!

hey ppl n hi peter! at last, found a way out.

Range r = Connect.myApplication.ActiveCell;
Microsoft.Office.Interop.Excel.Worksheet theSheet =
(Microsoft.Office.Interop.Excel.Worksheet)Connect. myApplication.Worksheets.get_Item(1);
theSheet.Shapes.AddOLEObject("Forms.CommandButton. 1",
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
"click_me", theSheet.get_Range(r, r).Left,theSheet.get_Range(r,
r).Top, theSheet.get_Range(r,
r).Width, theSheet.get_Range(r, r).Height);


Requires you to add MSForms 2.0, your addin should have a reference to
MSForms object library and use as MSForms.CommandButton.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2002 - Cell Reference for Active Button Trevor Williams Excel Programming 4 May 10th 07 01:41 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
Adding a control button to insert a date in the active cell. Mike Excel Discussion (Misc queries) 2 February 15th 05 06:27 PM
Change active cell properties with command button Nick Excel Programming 2 January 30th 04 05:11 PM
Change active cell properties with command button Beto[_3_] Excel Programming 0 January 30th 04 04:58 PM


All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"