Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locating the form button programatically 1

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I'm building form buttons with a statement of the like:
Code:
ActiveSheet.Buttons.Add(1000, 25, 40, 15).Select
Selection.OnAction = "View_Reporting_Unit"
etc

These buttons need to be neatly placed above a header for each table of data I print.

The Buttons.Add statement described above seems to lock you in to locating the button using X and Y offsets from the top left of the page.
I would like to tie the location of the buttons to a particular cell reference.
Is this possible?
 
The following snippet will fill the activecell with a button.

CellX = ActiveCell.Left
CellY = ActiveCell.Top
CellH = ActiveCell.Height
CellW = ActiveCell.Width
ActiveSheet.Buttons.Add CellX, CellY, CellW, CellH

Greg

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top