Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Application close problem

Good day, i need some help with the problem of, if the user has an
instance of excel open and is busy working then uses my document with
macro's and at the end i quit the application and his also closes and he
looses all his changes !! I believe you can check if there is other
instances of excel running and if yes then close workbook else quit.
I however am not sure how to write the code, could somebody please help.

thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Application close problem

Hi, maybe i did not explain myself properly. If the user is working with
a spreadsheet in excel and needs to run my excel document to do
something, excel needs to check how many workbooks are open and if only
1 then it will quit, however if there is more than 1 workbook open then
it must just close the workbook with my code in.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Application close problem

Tempy,
For your macro to run, hence there will be an instance of Excel.
I think what mean is "Was this instance already running before the user
opened my workbook ?"

You could evaluate Workbooks.Count, allowing for Personal and Add-Ins.

Or simply do not quit Excel.

NickHK

"Tempy" wrote in message
...
Good day, i need some help with the problem of, if the user has an
instance of excel open and is busy working then uses my document with
macro's and at the end i quit the application and his also closes and he
looses all his changes !! I believe you can check if there is other
instances of excel running and if yes then close workbook else quit.
I however am not sure how to write the code, could somebody please help.

thanks in advance

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Application close problem

Tempy,
Yes, so:
"You could evaluate Workbooks.Count, allowing for Personal and Add-Ins."

Correction: "You could evaluate Workbooks.Count, allowing for Personal"

NickHK

"Tempy" wrote in message
...
Hi, maybe i did not explain myself properly. If the user is working with
a spreadsheet in excel and needs to run my excel document to do
something, excel needs to check how many workbooks are open and if only
1 then it will quit, however if there is more than 1 workbook open then
it must just close the workbook with my code in.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Application close problem

Hello NickHK, i am unfortunately not a programmer, could explain please
and help with the code ?

Thanks

Tempy

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Application close problem

Hi i have tried the following:
wkb = Application.Workbooks.Count

But it only returns a count of 1 no matter how many workbooks are open ?


Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Application close problem

Tempy,
You are opening the workbooks in the same instance of Excel ?

Look at the Task manager to see how instances of Excel are running.

NickHK

"Tempy" wrote in message
...
Hi i have tried the following:
wkb = Application.Workbooks.Count

But it only returns a count of 1 no matter how many workbooks are open ?


Tempy

*** Sent via Developersdex http://www.developersdex.com ***



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Application close problem

If i look at my task manager it shows me 2 instances of excel running.

1. Microsft Excel - Recon_Master.xls (my doc with code)
a. Personal.xls
b. Recon_Master.xls
2. Microsoft Excel - Book1


Tempy

*** Sent via Developersdex http://www.developersdex.com ***
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Application close problem

Tempy
So if you put a button on a worksheet in your Recon_Master.xls, with this
code:

Private Sub CommandButton1_Click()
MsgBox Application.Workbooks.Count
End Sub

What value do you see ?

NickHK


"Tempy" wrote in message
...
If i look at my task manager it shows me 2 instances of excel running.

1. Microsft Excel - Recon_Master.xls (my doc with code)
a. Personal.xls
b. Recon_Master.xls
2. Microsoft Excel - Book1


Tempy

*** Sent via Developersdex http://www.developersdex.com ***



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
Trying to close Excel Application in IE Pommy Excel Discussion (Misc queries) 3 November 24th 05 03:36 PM
Close the other application Lulu Excel Programming 1 December 16th 04 05:43 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
Application.Close Nichevo Excel Programming 3 December 23rd 03 03:33 PM


All times are GMT +1. The time now is 05:00 PM.

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"