Join
the community
Sign-up
Ask a question Report

07 Wb opened w/ 03 and it Reopens after Close

Josh - Latest answer on Oct 10, 2012 12:47am BST
Hello,
Well, I am back after my short-lived exhuberance with my other solution. I now have a problem with some of the users that have Excel 2003. I created everything, including their workbooks, in 2007. For some reason, my code works just fine to close the workbook after some time, but for some reason the file reopens. This causes an issue because my main workbook tries to pull data from those workbooks and it can't do that when they are open. The code that I used is below.
This is in ThisWorkbook
-----------------------------------------------------------------------------------------------------
Option Explicit
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
ResetTimer
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ResetTimer
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
ResetTimer
End Sub
------------------------------------------------------------------------------------------------------
This is in the module
------------------------------------------------------------------------------------------------------
Public CloseDownTime As Variant
Public Sub ResetTimer()
On Error Resume Next
If Not IsEmpty(CloseDownTime) Then Application.OnTime EarliestTime:=CloseDownTime, Procedure:="CloseDownFile", Schedule:=False
CloseDownTime = Now + TimeValue("00:30:00") ' hh:mm:ss
Application.OnTime CloseDownTime, "CloseDownFile"
End Sub
Public Sub CloseDownFile()
On Error Resume Next
Application.StatusBar = "Inactive File Closed: " & ThisWorkbook.Name
ThisWorkbook.Close SaveChanges:=True
End Sub
------------------------------------------------------------------------------------------------------
Any assistance would be appreciated. This has got me stumped.
Thank you,
Josh
Read more 
12 answers
Answer
+0
moins plus
try to see this
http://www.ozgrid.com/Excel/run-macro-on-time.htm
Add comment
Answer
+0
moins plus
rizvisa1:
Thanks for the link and it's a great reference for creating OnTime events, however I'm still lost as to how the folder reopens on its how.

Thank you,
Josh
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - May 14, 2012 10:23pm BST
what is this "CloseDownTime" ?
Add comment
Answer
+0
moins plus
rizvisa1:

To be honest, I don't really know. Shows how green I am with coding. In my head, if it doesn't behave like this for excel 07 users, why does it behave like this for excel 03 users?

Any insight would be appreciated.

Thank you,
Josh
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - May 17, 2012 11:29pm BST
There are numerous reference to this in your code
I did not spot any place where this is being set
Add comment
Answer
+0
moins plus
Is it being set in this line?

CloseDownTime = Now + TimeValue("00:30:00") ' hh:mm:ss

Could it be that this is being set at the wrong time? Shoudl it be set sooner?

Thank you,
Josh
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - May 26, 2012 12:47pm BST
That line i did miss.

But i was confused over this
f Not IsEmpty(CloseDownTime) Then Application.OnTime EarliestTime:=CloseDownTime,

Is it possible to post a sample workbook with complete macro's at some file share site and posting back link to the file back here
Josh - May 29, 2012 5:03pm BST
rizvisa1:

The code I provided is the entire code. If you think providing a workbook with it in there, I can upload it. Let me know.

Thank you,
Josh
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - May 30, 2012 8:14am BST
I am confused over the three events that you have coded for . What is your intent here for each event?
Add comment
Answer
+0
moins plus
Josh, did you manage to work out how to resolve this workbook re-opening issue? I'm experiencing this as well and can't quite figure it out.

Thanks
Add comment
Answer
+0
moins plus
y.pango:

I did not find the solution for it. I've tried a few places to figure it out and everyone is at a loss.
Sorry,
Josh
rizvisa1 4230Posts Thursday January 28, 2010Registration date ContributorStatus May 7, 2013Last seen - Oct 10, 2012 12:47am BST
Could you post a sample book that can show the issue.
Add comment
This document entitled « 07 Wb opened w/ 03 and it Reopens after Close » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.

Not a member yet?

sign-up, it takes less than a minute and it's free!

Members get more answers than anonymous users.

Being a member gives you detailed monitoring of your requests.

Being a member gives you additional options.

Receive our newsletter

health.kioskea.net