Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Getting Forms button caption

ExcelXP & WinXP
My objective is to change the caption of the sole Forms button on the active
sheet when the sheet is selected/activated. My code wouldn't work so I
tried various modifications of the code. The following is an attempt to
just get the caption and it doesn't work either.
The error is "Object doesn't support this property or method." and the
offending line of code is the MsgBox line.
How do I get the button caption when the sheet is activated? Thanks for
your help. Otto

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim shp As Shape
For Each shp In Sh.Shapes
shp.Select
MsgBox shp.Characters.Text
Next shp
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Getting Forms button caption

Hi Otto,

Try:

Sub XYZ()
Dim BTn As Button

Set BTn = ActiveSheet.Buttons(1)
BTn.Caption = "XYZ"

End Sub



---
Regards,
Norman



"Otto Moehrbach" wrote in message
...
ExcelXP & WinXP
My objective is to change the caption of the sole Forms button on the
active sheet when the sheet is selected/activated. My code wouldn't work
so I tried various modifications of the code. The following is an attempt
to just get the caption and it doesn't work either.
The error is "Object doesn't support this property or method." and the
offending line of code is the MsgBox line.
How do I get the button caption when the sheet is activated? Thanks for
your help. Otto

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim shp As Shape
For Each shp In Sh.Shapes
shp.Select
MsgBox shp.Characters.Text
Next shp
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Getting Forms button caption

Otto,

or...
shp.TextFrame.Characters.Text

Jim Cone
San Francisco, USA


"Otto Moehrbach"

wrote in message

ExcelXP & WinXP
My objective is to change the caption of the sole Forms button on the active
sheet when the sheet is selected/activated. My code wouldn't work so I
tried various modifications of the code. The following is an attempt to
just get the caption and it doesn't work either.
The error is "Object doesn't support this property or method." and the
offending line of code is the MsgBox line.
How do I get the button caption when the sheet is activated? Thanks for
your help.
Otto
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim shp As Shape
For Each shp In Sh.Shapes
shp.Select
MsgBox shp.Characters.Text
Next shp
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Getting Forms button caption

Norman, Jim
Thanks for your help. Otto
"Otto Moehrbach" wrote in message
...
ExcelXP & WinXP
My objective is to change the caption of the sole Forms button on the
active sheet when the sheet is selected/activated. My code wouldn't work
so I tried various modifications of the code. The following is an attempt
to just get the caption and it doesn't work either.
The error is "Object doesn't support this property or method." and the
offending line of code is the MsgBox line.
How do I get the button caption when the sheet is activated? Thanks for
your help. Otto

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim shp As Shape
For Each shp In Sh.Shapes
shp.Select
MsgBox shp.Characters.Text
Next shp
End Sub




Reply
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
Change Caption of Button Alexander Excel Programming 3 August 17th 05 04:45 PM
How to change Button Caption? BrianB Excel Programming 3 June 1st 05 06:24 PM
Command Button Caption Qaspec Excel Programming 1 January 27th 05 03:30 PM
Change Caption of Forms Command Button No Name Excel Programming 9 December 10th 04 07:59 AM
Caption of a button Dr_Phil Excel Programming 4 May 4th 04 09:13 PM


All times are GMT +1. The time now is 03:05 AM.

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"