LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Combobox_Change event fires on workbook close

I have a workbook with a combobox 'CUPrevious' on one of its worksheets, with
change event coded (in the worksheet module) as follows:

Private Sub CUPrevious_Change()

Dim t As String

Application.ScreenUpdating = False
If Application.EnableEvents Then
Application.EnableEvents = False
End If

t = CUPrevious.LinkedCell

If Range(t).Value < "" Then
Call CUFunc(Range(t).Text)
End If

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

For some reason, whenever the workbook closes, this event is triggered and
if that sheet is not active at the time, the line
t = CUPrevious.LinkedCell
causes a runtime error as the value of linkedcell for the combobox seems to
be inaccessible. This is a problem which I have been able to get around by
calling the worksheet's Activate method in a Workbook.Before_Close procedure.
However, I don't see why the combobox change event should fire at all - the
value is not changing. Does anyone know why this is happening? More to the
point, is there some way to stop the event firing?

--
There are 10 types of people in the world - those who understand binary and
those who don't.
 
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
ComboBox.Clear method calling ComboBox_Change event? Clayman Excel Programming 2 August 1st 07 03:52 PM
ComboBox_Change Event to Populate another Combox Tobi Excel Programming 4 October 31st 06 11:34 PM
Combobox_change event problem Shawn G.[_2_] Excel Programming 2 August 18th 05 01:37 PM
worksheet_change event fires multiple times timconstan[_2_] Excel Programming 1 October 5th 04 07:44 PM
File|Close w/Save fires Workbook_Open twice Mike Preston Excel Programming 6 August 28th 03 10:54 PM


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

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"