Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
difference application.quit & application.close Pierre via OfficeKB.com[_2_] Excel Programming 4 November 8th 05 07:55 PM
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) Paul Martin Excel Programming 5 August 5th 05 04:44 PM
Replace application.RTD property by Application.RTDServers collect John.Greenan Excel Programming 1 July 7th 05 02:05 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM


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