Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How do I tell if user has closed Excel.

Tim,
AFAIK there's no indication.
Why does it matter to your WB ?

NickHK

"Tim Marsden" wrote in message
...
Hi,

I need to perform an action during the Workbook_beforeclose event. This I
can do, but I need to establish if the workbook is closing due to the user
exiting Excel or just closing the workbook. I need to perform additional
actions if Excel is closing.

Regards
Tim

--
Tim Marsden



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How do I tell if user has closed Excel.

Tim,
assuming that it's not actually a problem with your code :
If you are using Application Level Events, then you can hijacks Excel's
save, check the .saved property of each WB, if False show your own Save
dialog ("Do you want to save change Yes, no,Cancel), so you get the response
and act according. At the end set cancel=true.

NickHK

"Tim Marsden" wrote in message
...
Hi, thanks for your response.
It matters because, for example, if I have 2 workbooks open and the user
hits the cross in the corner to exit excel. The BeforeSave_Event fire for

the
first closing workbook, and I process it, running some tidy up code. The
events fires again for the second workbook, but an error occurs, or the

user
cancels. The fist workbook is still open but invalid as I tidied it up.

Regards
--
Tim Marsden


"NickHK" wrote:

Tim,
AFAIK there's no indication.
Why does it matter to your WB ?

NickHK

"Tim Marsden" wrote in message
...
Hi,

I need to perform an action during the Workbook_beforeclose event.

This I
can do, but I need to establish if the workbook is closing due to the

user
exiting Excel or just closing the workbook. I need to perform

additional
actions if Excel is closing.

Regards
Tim

--
Tim Marsden






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How do I tell if user has closed Excel.

Hello Tim,

I would like to know what error you get when you use the beforeclose event.

And what did you want to do after the beforeClose event fired by the
workbook?

Sincerely yours,

Wei Lu
Microsoft Online Partner Support

================================================== ===

PLEASE NOTE: The partner managed newsgroups are provided to assist with
break/fix
issues and simple how to questions.

We also love to hear your product feedback!

Let us know what you think by posting
- from the web interface: Partner Feedback
- from your newsreader: microsoft.private.directaccess.partnerfeedback.
We look forward to hearing from you!
================================================== ====
When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How do I tell if user has closed Excel.

Hello Tim,

As Nick has said, there are no indication to specify the Excel application
close.

I still interested on your Menu options. Do you mean the menubar in the
Excel or other controls in the workbook?

Since the Menu Options is related with workbooks, I don't know why your
need to access a global variable.

I am not sure but on my first thought, the global variable will be the
cause of this issue.

Could you please let me know some business logical in your application so
that we may found an alternate way to accomplish this?

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How do I tell if user has closed Excel.

Tim,
Why is the workbook not closing ?
If your closing code crashes Excel, seems there is a problem with the code
or the way the objects are referenced/destroyed.

NickHK

"Tim Marsden" wrote in message
...
Wei Lu,

We use the Workbooks for data capture, each workbook has a specific
function, and an object is created to handle validation, data retrieval

and
update. Different objects may be created for differnet Workbooks. These
objects contain business logic for the Workbook. As the user uses the
workbook, calls are made to functions in the associated object. These

objects
must be managed, i.e created when the Workbook is opened and destroyed

when
it is closed. The Workbook is useless without is corrsponding object. The
Beforeclose event can be used to destroy the object and tidied up, but

this
is only effective if the workbook is then closed. I have tried forcing the
close, but this seems to crash excel.

Regards
Tim

--
Tim Marsden


"Wei Lu [MSFT]" wrote:

Hello Tim,

As Nick has said, there are no indication to specify the Excel

application
close.

I still interested on your Menu options. Do you mean the menubar in the
Excel or other controls in the workbook?

Since the Menu Options is related with workbooks, I don't know why your
need to access a global variable.

I am not sure but on my first thought, the global variable will be the
cause of this issue.

Could you please let me know some business logical in your application

so
that we may found an alternate way to accomplish this?

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no

rights.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How do I tell if user has closed Excel.

Hi ,

How is everything going? Please feel free to let me know if you need any
assistance.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How do I tell if user has closed Excel.

I was thinking the OP could use a hidden userform and check the value of
CloseMode in the UserForm_QueryClose event for vbFormMDIForm, which I
supposed would be when Excel's main window is closed . However, XL2002 help
says "Note that vbFormMDIForm is also specified in the Object Browser, but
is not yet supported.".
Is it supported in XL2003 or 2007 ?
And if so, it is the correct value to look for ?

NickHK

"Wei Lu [MSFT]" wrote in message
...
Hi ,

How is everything going? Please feel free to let me know if you need any
assistance.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no

rights.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How do I tell if user has closed Excel.

Hello Tim,

Basically, Excel will close the current workbook first and close as the
descend order of the open order.

I will confirm this with internal.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default How do I tell if user has closed Excel.

Hi ,

How is everything going? Please feel free to let me know if you need any
assistance.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

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
Help - Closed excel doc with out saving it Sugan Excel Discussion (Misc queries) 3 May 16th 06 01:00 PM
Get Values from Closed Excel jm Excel Programming 7 September 29th 05 10:43 PM
Forcing Excel Closed John Excel Programming 4 July 19th 05 04:09 PM
Excel spreadsheet is closed Anders Excel Programming 5 January 23rd 05 01:34 PM
Forcing worksheets to be closed first when user trying to close excel Simon Lloyd[_603_] Excel Programming 0 November 6th 04 11:05 AM


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