Thread: buttons
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default buttons

Hi Dstiefe,

Try:

'=================
Sub ResetButton()
Dim i As Long
Dim BTN As Button
For i = 4 To ActiveWorkbook.Worksheets.Count

Set BTN = Sheets(i).Buttons.Add(298.5, 0.75, 51, 19.5)

With BTN
.OnAction = "ResetExpButton"
.Characters.Text = "Reset "
End With
Next i

End Sub
'<<=================

---
Regards,
Norman



"dstiefe" wrote in message
...
This is the code I currently have:

Sub resetbutton()
Dim ActSheet As Worksheet

sh = 3
Do
sh = sh + 1
Set ActSheet = Sheets(sh)

actsheet.Buttons.Add(298.5, 0.75, 51, 19.5).Select

With Selection
.OnAction = "ResetExpButton"
.Characters.Text = "Reset "
End With

Loop Until sh = Sheets.Count

End Sub

Problem. because I'm using "with selection" the "name of the button on
every page but the first(or active page) is not getting names "Reset ".

Solution. Is there anyway I can use : actsheet.Buttons.Add(298.5, 0.75,
51,
19.5).Select without using the "select" statement. In other words create
on
object for the button.

Thank you