ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   return .caption text of worksheet control (https://www.excelbanter.com/excel-programming/388740-return-caption-text-worksheet-control.html)

Susan

return .caption text of worksheet control
 
i've tried several ways to get this to work, but i can't. i'm
beginning to think you cannot get the .caption off the
control......... (when it's a toolbox control):

Private Sub OptionButton2_Click()
Initial_Sheet_Select ActiveSheet.OLEObjects _("OptionButton2")
End Sub


Public Sub Initial_Sheet_Select(OLEobj As OLEObject)
With OLEobj
sTab = .Caption
End With
wb.Sheets(sTab).Select
End Sub


any ideas?
thanks!
susan


Tom Ogilvy

return .caption text of worksheet control
 
Private Sub OptionButton2_Click()
Initial_Sheet_Select ActiveSheet.OLEObjects _
("OptionButton2")
End Sub


Public Sub Initial_Sheet_Select(OLEobj As OLEObject)
With OLEobj
sTab = .Object.Caption '<===
End With
wb.Sheets(sTab).Select
End Sub

--
Regards,
Tom Ogilvy


"Susan" wrote:

i've tried several ways to get this to work, but i can't. i'm
beginning to think you cannot get the .caption off the
control......... (when it's a toolbox control):

Private Sub OptionButton2_Click()
Initial_Sheet_Select ActiveSheet.OLEObjects _("OptionButton2")
End Sub


Public Sub Initial_Sheet_Select(OLEobj As OLEObject)
With OLEobj
sTab = .Caption
End With
wb.Sheets(sTab).Select
End Sub


any ideas?
thanks!
susan



Susan

return .caption text of worksheet control
 
THANK YOU THANK YOU THANK YOU!!!!
like an hour of agonizing & researching over a stupid period!!!
:)
susan


On May 4, 9:36 am, Tom Ogilvy
wrote:
Private Sub OptionButton2_Click()
Initial_Sheet_Select ActiveSheet.OLEObjects _
("OptionButton2")
End Sub

Public Sub Initial_Sheet_Select(OLEobj As OLEObject)
With OLEobj
sTab = .Object.Caption '<===
End With
wb.Sheets(sTab).Select
End Sub

--
Regards,
Tom Ogilvy



"Susan" wrote:
i've tried several ways to get this to work, but i can't. i'm
beginning to think you cannot get the .caption off the
control......... (when it's a toolbox control):


Private Sub OptionButton2_Click()
Initial_Sheet_Select ActiveSheet.OLEObjects _("OptionButton2")
End Sub


Public Sub Initial_Sheet_Select(OLEobj As OLEObject)
With OLEobj
sTab = .Caption
End With
wb.Sheets(sTab).Select
End Sub


any ideas?
thanks!
susan- Hide quoted text -


- Show quoted text -





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com