Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox_change event problem

I have a form that uses a combobox to fill in the textboxes on the form to be
edited using the change event. Work great but when the text boxes are all
edited and the user press the OK button to copy the fields to the worksheet
as soon as it gets to the first
..cells(4, 1).Value = frmEditText.txtbxName.Value
It immediatley goes to the combobox_change event, which resets the form.
Any way around this or a way to turn off the combobox_change event
temporarily while the code fills in the proper cells?????
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Combobox_change event problem

Hi,
You could use a variable to track whether the event should be processed or
not:
'form level variable
Private ProcessingOk as boolean

'in your CmdOk_Click sub, set processingOk
Sub CmdOk_Click( )
ProcessingOk=True
' ... processing code here
ProcessingOk = False
End Sub

'in your other controls event subs, process only if Not OrocessingOk.
'Eg
Sub combobox_change ( )
If Not ProcessingOk Then
'your regular code here
End if
End Sub

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Shawn G." wrote:

I have a form that uses a combobox to fill in the textboxes on the form to be
edited using the change event. Work great but when the text boxes are all
edited and the user press the OK button to copy the fields to the worksheet
as soon as it gets to the first
.cells(4, 1).Value = frmEditText.txtbxName.Value
It immediatley goes to the combobox_change event, which resets the form.
Any way around this or a way to turn off the combobox_change event
temporarily while the code fills in the proper cells?????

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Combobox_change event problem

Thank you, I hadn't thought of that!!! Worked great!

"sebastienm" wrote:

Hi,
You could use a variable to track whether the event should be processed or
not:
'form level variable
Private ProcessingOk as boolean

'in your CmdOk_Click sub, set processingOk
Sub CmdOk_Click( )
ProcessingOk=True
' ... processing code here
ProcessingOk = False
End Sub

'in your other controls event subs, process only if Not OrocessingOk.
'Eg
Sub combobox_change ( )
If Not ProcessingOk Then
'your regular code here
End if
End Sub

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Shawn G." wrote:

I have a form that uses a combobox to fill in the textboxes on the form to be
edited using the change event. Work great but when the text boxes are all
edited and the user press the OK button to copy the fields to the worksheet
as soon as it gets to the first
.cells(4, 1).Value = frmEditText.txtbxName.Value
It immediatley goes to the combobox_change event, which resets the form.
Any way around this or a way to turn off the combobox_change event
temporarily while the code fills in the proper cells?????

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
WB before save event problem GregR Excel Programming 2 August 17th 05 04:38 PM
problem with beforeclose event Gordon Excel Programming 1 September 30th 04 11:21 PM
ComboBox_Change sub runs unexpectedly ChrisHouchin Excel Programming 0 May 25th 04 07:21 PM
Problem with SheetCalculate Event Jim Rech Excel Programming 3 November 6th 03 02:08 PM


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