thisworkbook.saveAs triggers change event?

A

Alerion

I run to this problem today.
Whether or not I use VBA to save my workbook, it triggers a change event in
the first combobox in the code. Then it seems to reset the selection in some
other comboboxes.

Why is this happening and how can I prevent it?

Alerion
 
A

Alerion

Figured this one out myself, sort of. As excel really shouldn't raise a
change event in my comboboxes when I try to save my workbook, and I couldn't
find a way to prevent it, I found a way to evade the problem. "Using
application.enableEvents = false" didn't help at all.

The solution was to declare a variable of boolean type and set it true as
the saving begins. (remember to set if false as it finishes.) To every change
event I wrote if thisboolean is false then execute the code. Ie. if not, skip
the unwanted event.

Hope this helps others as this seems to be a bug in excel.
 
R

Rick Humphrey

Thanks,

Wish I looked here first, better yet wish I thought of the jumper to
use.... It is always gratifying to find someone else who is struggling with
the same thing I've been banging my head against.... Why does Excel think I
changed the selected item in my combo box when I am closing the workbook?

Rick
 
A

Alerion

No problem. I have no knowledge why some events are fired spontaneously. The
same problem is actually now discussed in another thread. You can find it
with the subject "fires events without reason".

Alerion


"Rick Humphrey" kirjoitti:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top