Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default ComboBox1_Change - is triggered when file closes

Hi,

I have a combo box (created using control toolbox) which triggers an event
every time an item is selected from the drop down list (Private Sub
ComboBox1_Change()). I populated the list from a named range on one of he
worksheets. Included toward the top of the macro is the line:

[A1].Activate (or Select)

Without this line, the event does not fire properly since focus remains on
the combo box. Apparently my commands to do something on the sheet (eg
highlight certain cells) does not happen unless focus switches to the sheet.

When I make a manual change to a cell which is part of the named range that
populates the drop down list, the combo box "changes," the macro fires and I
get an error:
" Activate method (or Select method) of Range class failed."

I understand why.
What I can't understand is why the same error is occurs when I close the
file. For some reason, the combo box change sub is triggered upon close and
the Activate method (or Select method) fails.

What am I doing wrong? Is there another way to shift focus to the sheet? Why
does closing the file trigger the combo box change macro?

Any help in solving this will be greatly appreciated. Thanks.
--
eugene
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default ComboBox1_Change - is triggered when file closes

Hi Eugene,

I think your question can not be answered without giving us more information
about the code in the macro. A Combobox-change event generally does not
require any switch of focus to the Worksheet

JB

"eugene" wrote:

Hi,

I have a combo box (created using control toolbox) which triggers an event
every time an item is selected from the drop down list (Private Sub
ComboBox1_Change()). I populated the list from a named range on one of he
worksheets. Included toward the top of the macro is the line:

[A1].Activate (or Select)

Without this line, the event does not fire properly since focus remains on
the combo box. Apparently my commands to do something on the sheet (eg
highlight certain cells) does not happen unless focus switches to the sheet.

When I make a manual change to a cell which is part of the named range that
populates the drop down list, the combo box "changes," the macro fires and I
get an error:
" Activate method (or Select method) of Range class failed."

I understand why.
What I can't understand is why the same error is occurs when I close the
file. For some reason, the combo box change sub is triggered upon close and
the Activate method (or Select method) fails.

What am I doing wrong? Is there another way to shift focus to the sheet? Why
does closing the file trigger the combo box change macro?

Any help in solving this will be greatly appreciated. Thanks.
--
eugene

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default ComboBox1_Change - is triggered when file closes

Excelerate-nl:

Thanks a million.

I just commented out the offensive line without any ill effect (so far) and
my problem is solved.

Apparently, my original problem was fixed by something else I did, not by
shifting focus to the worksheet, as I thought.

Just goes to show you again how this board is a real time-saver. It probably
would have taken me endless hours to discover what you jsut told me. Thanks
again.

--
eugene


"Excelerate-nl" wrote:

Hi Eugene,

I think your question can not be answered without giving us more information
about the code in the macro. A Combobox-change event generally does not
require any switch of focus to the Worksheet

JB

"eugene" wrote:

Hi,

I have a combo box (created using control toolbox) which triggers an event
every time an item is selected from the drop down list (Private Sub
ComboBox1_Change()). I populated the list from a named range on one of he
worksheets. Included toward the top of the macro is the line:

[A1].Activate (or Select)

Without this line, the event does not fire properly since focus remains on
the combo box. Apparently my commands to do something on the sheet (eg
highlight certain cells) does not happen unless focus switches to the sheet.

When I make a manual change to a cell which is part of the named range that
populates the drop down list, the combo box "changes," the macro fires and I
get an error:
" Activate method (or Select method) of Range class failed."

I understand why.
What I can't understand is why the same error is occurs when I close the
file. For some reason, the combo box change sub is triggered upon close and
the Activate method (or Select method) fails.

What am I doing wrong? Is there another way to shift focus to the sheet? Why
does closing the file trigger the combo box change macro?

Any help in solving this will be greatly appreciated. Thanks.
--
eugene

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
File closes without prompting to save freyabeads Excel Discussion (Misc queries) 0 March 1st 06 01:00 PM
calculation - prompting to save when file closes lpj Excel Discussion (Misc queries) 0 February 14th 06 08:27 PM
Add code to Private Sub ComboBox1_Change() with a macro from a different workbook help_wanted[_2_] Excel Programming 4 April 2nd 04 06:47 PM
Help - Change Event triggered on File Save As Dee Veloper Excel Programming 4 October 29th 03 02:16 AM
programmatically close help file before Excel closes? RB Smissaert Excel Programming 2 July 21st 03 11:49 AM


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