Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default on exit field

Hi,
On a user form, I have a field that fires "on exit". if the cursor is in
this field when a command button is clicked, the code for the on exit runs,
not the code for the button clicked. the button code is "on click".
Is there some way to know what button is clicked so the on exit code could
test for the click?
Is there some trick to get the cursor out of the field without firing the
code?
any help or ideas would be greatly appreciated.

peter




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default on exit field

Hi Peter,

I don't think you are going to prevent the On Exit event firing. You can
only include code within the On Exit event sub to exit the sub under
specified conditions.

Perhaps you can tell us why you don't want the event to fire and why you
need to click a command button without running the On Exit code. The reason I
ask this is because I have used the Double Click event to call a procedure
such as add items to a combo box so if it is some code you want to run before
exiting the field then maybe that is the way to go.
--
Regards,

OssieMac


"peter" wrote:

Hi,
On a user form, I have a field that fires "on exit". if the cursor is in
this field when a command button is clicked, the code for the on exit runs,
not the code for the button clicked. the button code is "on click".
Is there some way to know what button is clicked so the on exit code could
test for the click?
Is there some trick to get the cursor out of the field without firing the
code?
any help or ideas would be greatly appreciated.

peter




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default on exit field

Just use a module scope Boolean which you test in the OnExit procedure, and
set that Boolean as required.

--
__________________________________
HTH

Bob

"peter" wrote in message
...
Hi,
On a user form, I have a field that fires "on exit". if the cursor is in
this field when a command button is clicked, the code for the on exit
runs,
not the code for the button clicked. the button code is "on click".
Is there some way to know what button is clicked so the on exit code could
test for the click?
Is there some trick to get the cursor out of the field without firing the
code?
any help or ideas would be greatly appreciated.

peter






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default on exit field

Is this commandbutton the Cancel button of the userform?

If yes, then you could change its .takefocusonclick property to False (either in
the userform_initialize procedure or manually in the properties window).


peter wrote:

Hi,
On a user form, I have a field that fires "on exit". if the cursor is in
this field when a command button is clicked, the code for the on exit runs,
not the code for the button clicked. the button code is "on click".
Is there some way to know what button is clicked so the on exit code could
test for the click?
Is there some trick to get the cursor out of the field without firing the
code?
any help or ideas would be greatly appreciated.

peter


--

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
Exit Field vs Exit Button...... roy_ware Excel Programming 2 October 10th 07 04:05 PM
macro on exit of field Manuel Murieta Excel Programming 4 February 13th 07 06:38 PM
How to make a field created a part of the Pivot Table Field List? drhell Excel Discussion (Misc queries) 0 January 29th 07 11:13 PM
Linked date field in worksheet defaults a blank field as 1/0/1900 AmnNkD Excel Worksheet Functions 2 September 12th 06 05:42 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


All times are GMT +1. The time now is 11:45 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"