Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trying to close Excel Application in IE | Excel Discussion (Misc queries) | |||
Close the other application | Excel Programming | |||
macro to close excel application other than application.quit | Excel Programming | |||
Application.Close | Excel Programming |