Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default RefEdit in Class Module Problem

Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both Change and Exit
events working without a problem. I subsequently defined a Class
module that would contain a RefEdit control and moved the UserForm's
code to the Class module. In the Class module, the Change event code
works without a problem, but the Exit event's code will not work. Even
something as simple as the code below won't work. Any ideas on why
not? One would think that if the Change event code worked, they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default RefEdit in Class Module Problem

Upon further researching this, it appears that the Exit event doesn't
exist in the Class module for a RefEdit control, although the Change
event does exist. Can anyone explain to me why the Exit event doesn't
exist? Without its existence, I suppose I am left to using the
original code in the UserForm?

Thanks.

Mark


Mark Driscol wrote:
Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both Change and Exit
events working without a problem. I subsequently defined a Class
module that would contain a RefEdit control and moved the UserForm's
code to the Class module. In the Class module, the Change event code
works without a problem, but the Exit event's code will not work. Even
something as simple as the code below won't work. Any ideas on why
not? One would think that if the Change event code worked, they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default RefEdit in Class Module Problem

Chip, I see you are online today, can you shed any light on this? Just
wondering if there is a way in advance to tell what Events are/are not
available in a Class module before formulating a solution.

Any input would be appreciated.

Mark


Mark Driscol wrote:
Upon further researching this, it appears that the Exit event doesn't
exist in the Class module for a RefEdit control, although the Change
event does exist. Can anyone explain to me why the Exit event doesn't
exist? Without its existence, I suppose I am left to using the
original code in the UserForm?

Thanks.

Mark


Mark Driscol wrote:
Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both Change and Exit
events working without a problem. I subsequently defined a Class
module that would contain a RefEdit control and moved the UserForm's
code to the Class module. In the Class module, the Change event code
works without a problem, but the Exit event's code will not work. Even
something as simple as the code below won't work. Any ideas on why
not? One would think that if the Change event code worked, they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default RefEdit in Class Module Problem

Some events are available only in the container object of the
control. This applies especially to text boxes, and a RefEdit is
just a juiced up text box. You can use the Exit event in your
form module:

Private Sub RefEdit1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "exit "
End Sub

but the same will not work in a class module containing a
WithEvents RefEdit object.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Mark Driscol" wrote in message
oups.com...
Chip, I see you are online today, can you shed any light on
this? Just
wondering if there is a way in advance to tell what Events
are/are not
available in a Class module before formulating a solution.

Any input would be appreciated.

Mark


Mark Driscol wrote:
Upon further researching this, it appears that the Exit event
doesn't
exist in the Class module for a RefEdit control, although the
Change
event does exist. Can anyone explain to me why the Exit event
doesn't
exist? Without its existence, I suppose I am left to using
the
original code in the UserForm?

Thanks.

Mark


Mark Driscol wrote:
Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both Change
and Exit
events working without a problem. I subsequently defined a
Class
module that would contain a RefEdit control and moved the
UserForm's
code to the Class module. In the Class module, the Change
event code
works without a problem, but the Exit event's code will not
work. Even
something as simple as the code below won't work. Any ideas
on why
not? One would think that if the Change event code worked,
they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default RefEdit in Class Module Problem

Thank you, Chip, I discovered that after I had debugged the code in my
UserForm, and then ported it all over to my Class module. I just
didn't know if there were ways in advance to tell if an Event existed
in a Class module or not. I could have saved myself the trouble of
porting it over. I have several RefEdits on my UserForm and was trying
to avoid having to have separate Event codes for each one, but it
appears not.

Thanks for responding.

Mark


Chip Pearson wrote:
Some events are available only in the container object of the
control. This applies especially to text boxes, and a RefEdit is
just a juiced up text box. You can use the Exit event in your
form module:

Private Sub RefEdit1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "exit "
End Sub

but the same will not work in a class module containing a
WithEvents RefEdit object.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Mark Driscol" wrote in message
oups.com...
Chip, I see you are online today, can you shed any light on
this? Just
wondering if there is a way in advance to tell what Events
are/are not
available in a Class module before formulating a solution.

Any input would be appreciated.

Mark


Mark Driscol wrote:
Upon further researching this, it appears that the Exit event
doesn't
exist in the Class module for a RefEdit control, although the
Change
event does exist. Can anyone explain to me why the Exit event
doesn't
exist? Without its existence, I suppose I am left to using
the
original code in the UserForm?

Thanks.

Mark


Mark Driscol wrote:
Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both Change
and Exit
events working without a problem. I subsequently defined a
Class
module that would contain a RefEdit control and moved the
UserForm's
code to the Class module. In the Class module, the Change
event code
works without a problem, but the Exit event's code will not
work. Even
something as simple as the code below won't work. Any ideas
on why
not? One would think that if the Change event code worked,
they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default RefEdit in Class Module Problem

You can determine all the events supported by an object declared
WithEvents by selecting the variable name in the top left-hand
drop down in the code window. All events supported by that
control will appear in the right-hand drop down. If you select
an event from the right-hand drop down, VBA will insert the
proper Sub statement and an End Sub statement.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Mark Driscol" wrote in message
ups.com...
Thank you, Chip, I discovered that after I had debugged the
code in my
UserForm, and then ported it all over to my Class module. I
just
didn't know if there were ways in advance to tell if an Event
existed
in a Class module or not. I could have saved myself the
trouble of
porting it over. I have several RefEdits on my UserForm and
was trying
to avoid having to have separate Event codes for each one, but
it
appears not.

Thanks for responding.

Mark


Chip Pearson wrote:
Some events are available only in the container object of the
control. This applies especially to text boxes, and a RefEdit
is
just a juiced up text box. You can use the Exit event in your
form module:

Private Sub RefEdit1_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
MsgBox "exit "
End Sub

but the same will not work in a class module containing a
WithEvents RefEdit object.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Mark Driscol" wrote in message
oups.com...
Chip, I see you are online today, can you shed any light on
this? Just
wondering if there is a way in advance to tell what Events
are/are not
available in a Class module before formulating a solution.

Any input would be appreciated.

Mark


Mark Driscol wrote:
Upon further researching this, it appears that the Exit
event
doesn't
exist in the Class module for a RefEdit control, although
the
Change
event does exist. Can anyone explain to me why the Exit
event
doesn't
exist? Without its existence, I suppose I am left to using
the
original code in the UserForm?

Thanks.

Mark


Mark Driscol wrote:
Excel 2002, Windows XP Version 2002, SP1

I have a RefEdit control on a UserForm that has both
Change
and Exit
events working without a problem. I subsequently defined
a
Class
module that would contain a RefEdit control and moved the
UserForm's
code to the Class module. In the Class module, the
Change
event code
works without a problem, but the Exit event's code will
not
work. Even
something as simple as the code below won't work. Any
ideas
on why
not? One would think that if the Change event code
worked,
they Exit
event code would work as well.


Public WithEvents RefEdit As RefEdit.RefEdit

Private Sub RefEdit_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
MsgBox "Hello"
End Sub


Thanks in advance.

Mark




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
Class Module Problem Jason Zischke Excel Programming 2 June 27th 06 06:07 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
Userform with template class module problem Tom Ogilvy Excel Programming 1 July 18th 03 09:15 PM
Userform with template class module problem Tom Ogilvy Excel Programming 0 July 17th 03 06:38 PM


All times are GMT +1. The time now is 12:18 PM.

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"