Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Can't Trigger Event Procedure from a Checkbox created on the Fly.

I'm creating a checkbox on the fly in a form. I know that the checkbox
name will be CkBox1 so I already created the following event procedure.
For some reason I can't get the event procedure to trigger when I click
on the checkbox that was created. I'm sure that it has something to do
with the fact that I'm creating procedure before the control is
created, but I would imagine there has to be a way. And due to the fact
that this form needs to be very dynamic, I can't really get away with
just creating the controls and hiding/unhiding them.
Any suggestions would be appreciated.

Thanks,
James

Private Sub CkBox1_Change()
If PackageForm.Controls("CkBox1").Value = True Then
With PackageForm.Controls("TBox4")
.Enabled = True
.Locked = False
.BackStyle = fmBackStyleOpaque
End With
Else
With PackageForm.Controls("TBox4")
.Enabled = False
.Locked = True
.BackStyle = fmBackStyleTransparent
.Value = ""
End With
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Can't Trigger Event Procedure from a Checkbox created on the Fly.


JGeniti wrote:
I'm creating a checkbox on the fly in a form. I know that the checkbox
name will be CkBox1 so I already created the following event procedure.
For some reason I can't get the event procedure to trigger when I click
on the checkbox that was created. I'm sure that it has something to do
with the fact that I'm creating procedure before the control is
created, but I would imagine there has to be a way. And due to the fact
that this form needs to be very dynamic, I can't really get away with
just creating the controls and hiding/unhiding them.
Any suggestions would be appreciated.

Thanks,
James

Private Sub CkBox1_Change()
If PackageForm.Controls("CkBox1").Value = True Then
With PackageForm.Controls("TBox4")
.Enabled = True
.Locked = False
.BackStyle = fmBackStyleOpaque
End With
Else
With PackageForm.Controls("TBox4")
.Enabled = False
.Locked = True
.BackStyle = fmBackStyleTransparent
.Value = ""
End With
End If
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
Trigger an event on Checkbox change James Geniti Excel Programming 0 September 1st 04 09:24 PM
Trigger an event on Checkbox change James[_28_] Excel Programming 2 September 1st 04 08:31 PM
Trigger Event Todd Huttenstine Excel Programming 2 July 14th 04 06:50 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM
Using a checkbox to trigger an email Chris Excel Programming 1 August 12th 03 11:00 PM


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

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"