MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Lost Focus

  Asked By: Kiswar    Date: Nov 05    Category: MS Office    Views: 722

This isn't really a question as much as it is an
observation and possibly a lesson.

I've been a member of this group for a little while now.
I originally joined to find the answer to a question.
Which, while I didn't find the answer I was looking for, I was at
least pointed down the right path.

Since then, I've tried to make a contribution whenever I can and I've
learned a lot by trying things that I normally don't encounter in my
day-to-day activities.

Yesterday, I came across a problem that stumped me. I did a brief
search, without result and begain writing up the description to post
to this group. But I pride myself on my "Deductive Reasoning" skills
and posting the question felt like Defeat. So I once again applied
myself to the problem and found a very simple solution.

Here's the story:
I have nearly 28,000 excel "documents", with archived versions, there
are nearly 47,000 documents.
The content of some documents "refer" to other documents.
I wanted to produce a double-click event that would allow me to open
the referenced document in another Excel session.

This worked well, but when I closed the "child" document, I could no
longer select anything in the "parent" document unless I minimized it
and restored it. This was the perplexing problem.

As it turned out, the problem was in a BeforeClose event.
I was using this event to perform a variety of things, but in the
end, I used it to close the file without saving, and without
prompting the user to save (I only allow certain user groups to save
these documents)

To accomplish this, I was cancelling the user's close action and
ActiveWorkbook.Close savechanges:=False

This worked well, until I added this new "feature". I'm not sure why
it caused a problem, and I don't really care (now that I fixed it)
Instead, I added:
ThisWorkbook.Saved = True
and allowed the user's "close" action to continue.
Now the problem's gone and all is right in my world.

This morning, I got to thinking about something though.
I only knew about this method because I read it somewhere (possibly
this user group). If someone else hadn't accepted "defeat" and
posted the question, it wouldn't have been there for me to read and I
may not have discovered the solution so easily.

So I guess here's my "lesson":
Just because you've found the answer to your problem, doesn't mean
that others can't benefit from your "epiphany". And, just because
you can see the destination doesn't mean that you can't learn
something along the way!

Thanks to all of those that have admitted defeat and asked their
questions, and thanks to those that have shared their knowledge!