Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quting excel from within application
I've got a very strange problem for which I can't find an explanation. The application I made quits excel using application.quit. Befor doing this I check if the workbook was saved and if not save it. Code ------------------- 'Check if the workbook was saved If Workbooks(ThisWorkbook.Name).Saved = False Then 'Save this workbook Workbooks(ThisWorkbook.Name).Save End If 'Close excel Application.Qui ------------------- Using above code I would think that the application would quit withou asking for it to be saved. Well, it doesn't. Only when I add th application.displayalerts = false statement will it do so. Afterward when checking I can't find any differences between a saved and no saved workbook though. Apart from that, when quiting the applicatio there's only 1 workbook open. It becomes weirder when you know that this problem only occurs afte having done something using the application. The application itself i basically a database which displays data in textboxes depending upo certain criteria. It has 2 worksheets being 1 for the data used itsel and 1 which contains temp data used in the application. Both sheet though are saved when using the workbooks().save statement. Could any of you offer an explanation of this strange behavior or migh have experienced similar before? Is this maybe some sort of bug lik the usedrange problem? I use the workaround of setting displayalerts to off now but I woul really like to know why this happens. Thanks and best regards, Leo -- droopy928g ----------------------------------------------------------------------- droopy928gt's Profile: http://www.excelforum.com/member.php...fo&userid=3023 View this thread: http://www.excelforum.com/showthread.php?threadid=53771 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quting excel from within application
Possibly
http://support.microsoft.com/kb/289111/en-us by the way, there is no problem with UsedRange except possibly in the initial release of xl2000. Possibly you speak of the a misperception as to what UsedRange actually portrays. -- Regards, Tom Ogilvy "droopy928gt" wrote: I've got a very strange problem for which I can't find an explanation. The application I made quits excel using application.quit. Before doing this I check if the workbook was saved and if not save it. Code: -------------------- 'Check if the workbook was saved If Workbooks(ThisWorkbook.Name).Saved = False Then 'Save this workbook Workbooks(ThisWorkbook.Name).Save End If 'Close excel Application.Quit -------------------- Using above code I would think that the application would quit without asking for it to be saved. Well, it doesn't. Only when I add the application.displayalerts = false statement will it do so. Afterwards when checking I can't find any differences between a saved and non saved workbook though. Apart from that, when quiting the application there's only 1 workbook open. It becomes weirder when you know that this problem only occurs after having done something using the application. The application itself is basically a database which displays data in textboxes depending upon certain criteria. It has 2 worksheets being 1 for the data used itself and 1 which contains temp data used in the application. Both sheets though are saved when using the workbooks().save statement. Could any of you offer an explanation of this strange behavior or might have experienced similar before? Is this maybe some sort of bug like the usedrange problem? I use the workaround of setting displayalerts to off now but I would really like to know why this happens. Thanks and best regards, Leon -- droopy928gt ------------------------------------------------------------------------ droopy928gt's Profile: http://www.excelforum.com/member.php...o&userid=30232 View this thread: http://www.excelforum.com/showthread...hreadid=537711 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quting excel from within application
Hi Tom, Thanks for the reply. I'm not at work at the moment but am surely gonna try this tomorrow. The application though I've made was started and written using excel2003. Only a couple of months ago did I once open and work on it in excel2000 but since then I've also upgraded my homecomputers to excel2003. Let you know though as this one really had me puzzled. As for the usedrange bug, maybe I referred to it wrongly but what I meant was for workbooks to become bloated over time without any significant reason. This occurred to me also and ended up with a workbook of 7.5MB. Searching this forum I found a simple routine with which I could reduce it to 700KB. Apparently excel didn't release empty cells properly for which the only solution was to delete empty rows and then saving the sheet again. Thanks again and best regards, Leon -- droopy928gt ------------------------------------------------------------------------ droopy928gt's Profile: http://www.excelforum.com/member.php...o&userid=30232 View this thread: http://www.excelforum.com/showthread...hreadid=537711 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quting excel from within application
I understand what you are saying about the usedrange, but I would have to
categorize that as your own "misconduct" <g. There are other things beside a value being stored in a cell that will cause excel to store information about that cell and appear "bloated" as you say. -- Regards, Tom Ogilvy "droopy928gt" wrote: Hi Tom, Thanks for the reply. I'm not at work at the moment but am surely gonna try this tomorrow. The application though I've made was started and written using excel2003. Only a couple of months ago did I once open and work on it in excel2000 but since then I've also upgraded my homecomputers to excel2003. Let you know though as this one really had me puzzled. As for the usedrange bug, maybe I referred to it wrongly but what I meant was for workbooks to become bloated over time without any significant reason. This occurred to me also and ended up with a workbook of 7.5MB. Searching this forum I found a simple routine with which I could reduce it to 700KB. Apparently excel didn't release empty cells properly for which the only solution was to delete empty rows and then saving the sheet again. Thanks again and best regards, Leon -- droopy928gt ------------------------------------------------------------------------ droopy928gt's Profile: http://www.excelforum.com/member.php...o&userid=30232 View this thread: http://www.excelforum.com/showthread...hreadid=537711 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quting excel from within application
Hi Tom, You're so right about the other things causing cells to not be emptied The problem, at least for me, was always that I never set or use thos things like fontsize, type, borders, etc. The only thing I did was t enter a number or text in cells. Apart from that, if you use a comman like .clearcontent you would expect a cell to be empty / unused but i isn't. Nowadays I use, also for this, a workaround to the actual problem b using .specialcells(xlconstants) to select and clear in combinatio with the code courtesy of DJR during quiting to delete empty rows. This does help but debatably should not have to be used. Haven't tried your initial suggestion yet but will post when I do. Best regards, Leo -- droopy928g ----------------------------------------------------------------------- droopy928gt's Profile: http://www.excelforum.com/member.php...fo&userid=3023 View this thread: http://www.excelforum.com/showthread.php?threadid=53771 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
difference application.quit & application.close | Excel Programming | |||
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) | Excel Programming | |||
Replace application.RTD property by Application.RTDServers collect | Excel Programming | |||
macro to close excel application other than application.quit | Excel Programming | |||
application.quit will not shut off application | Excel Programming |