View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Change 'Caption' on ToggleButtons with VBA

Thanks a bunch, Greg. The Object property of the OleObjects collection was
what I was missing. Your procedure worked perfectly and I'll be using this a
lot in the near future.

--
Thanks again,
Jay


"Greg Wilson" wrote:

Try:

Sub addToggles()
Dim i As Integer
For i = 0 To 1
With ActiveSheet.OLEObjects.Add("Forms.ToggleButton.1", _
Left:=1 + i * 73, Top:=243, Width:=72, Height:=30.75)
.Object.Caption = IIf(i = 0, "Start Date", "End Date")
End With
Next
End Sub

Regards,
Greg