Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Label in Excel... change caption from VB

I have a situation were if a check (tick) box is checked, then a label
has to be displayed on the worksheet with a certain text. If the check
box is unchecked, the label has to disappear. I have managed to display
the label according to my conditions, but every time it appears, the
caption reads "label1" and NOT the text I expect it too. How do I code
the label captioning into my program?
To display the label, this is the code I used.

Private Sub CheckBox6_Click()
ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label .1", Link:=False, _
DisplayAsIcon:=False, Left:=136.5, Top:=72.75, Width:=72,
Height:=18) _
.Select
Range("E8").Select
End Sub

Any help would be appreciated.... thanx

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Label in Excel... change caption from VB

How about an alternative.

Create the label manually--set up the caption to what you want.

Make sure that checkbox1 controls label1, checkbox2 controls label2, etc.

Then you can just use code to hide/show the label:

Option Explicit
Private Sub CheckBox1_Click()
Me.Label1.Visible = CBool(Me.CheckBox1.Value = True)
End Sub




" wrote:

I have a situation were if a check (tick) box is checked, then a label
has to be displayed on the worksheet with a certain text. If the check
box is unchecked, the label has to disappear. I have managed to display
the label according to my conditions, but every time it appears, the
caption reads "label1" and NOT the text I expect it too. How do I code
the label captioning into my program?
To display the label, this is the code I used.

Private Sub CheckBox6_Click()
ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label .1", Link:=False, _
DisplayAsIcon:=False, Left:=136.5, Top:=72.75, Width:=72,
Height:=18) _
.Select
Range("E8").Select
End Sub

Any help would be appreciated.... thanx


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Label in Excel... change caption from VB

Works like a charm .... thank you kindly, Dave

Dave Peterson wrote:
How about an alternative.

Create the label manually--set up the caption to what you want.

Make sure that checkbox1 controls label1, checkbox2 controls label2, etc.

Then you can just use code to hide/show the label:

Option Explicit
Private Sub CheckBox1_Click()
Me.Label1.Visible = CBool(Me.CheckBox1.Value = True)
End Sub




" wrote:

I have a situation were if a check (tick) box is checked, then a label
has to be displayed on the worksheet with a certain text. If the check
box is unchecked, the label has to disappear. I have managed to display
the label according to my conditions, but every time it appears, the
caption reads "label1" and NOT the text I expect it too. How do I code
the label captioning into my program?
To display the label, this is the code I used.

Private Sub CheckBox6_Click()
ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label .1", Link:=False, _
DisplayAsIcon:=False, Left:=136.5, Top:=72.75, Width:=72,
Height:=18) _
.Select
Range("E8").Select
End Sub

Any help would be appreciated.... thanx


--

Dave Peterson


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
label caption gramps Excel Discussion (Misc queries) 0 November 1st 07 03:56 PM
Change label caption on userForm while code runs Sliman Excel Programming 1 March 16th 06 05:38 PM
label caption equal excel value Monique Excel Worksheet Functions 1 July 12th 05 07:33 PM
Dynamic Label Caption Turtle MacDermott Excel Programming 6 November 22nd 04 02:43 PM
label caption Rod Taylor Excel Programming 2 July 31st 03 03:25 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"