Rabu, 28 November 2012

Re: Vedr: [ExcelVBA] Re: counter problem

 

Sorry I couldn't be more help.

Although, I strongly suspect that your case is similar to mine..
Inserting Sleep/pauses isn't really causing your Excel session to "hang".
It's just going into a "reduced Priority" condition, where it's only using
a fraction of the CPU cycles, AND, it won't let you interrupt the macro.
I've found that if I leave the computer COMPLETELY alone, Windows will
eventually decide that there's nothing better going on and will return
to Excel.. But that means that I cannot even touch the mouse!
Since mouse movement is a VERY high priority...

I've dealt with this prioritization problem since Excel2007.

It normally is only noticeable when macros run longer than a specific period of
time.

(more than a minute?)
It happens almost IMMEDIATELY if you select another window while the macro is
running.

As in:
Your macro is running, so you decide to check your email while you're waiting.

In my case, I have one macro that usually runs in about 3 minutes.
If, while it's running, I switch to Internet Explorer, the macro then takes
10-15 minutes.

(I used the timer() function to log start/end times to document).

If I keep the Excel application "in focus", then the macro runs in 3 minutes.
Strangely enough, I've even seen it take longer if I select the VBE window!

In Excel2007, setting the process priority solved my problem, and everything
worked smoothly.

For some reason, it doesn't work the same in Excel2010.
However, it actually COULD be a change in Windows7, since we upgraded to
Windows7 and Office 2010 simultaneously.

Using this logic, I can see why anything indicating that you want Excel to
"sleep" or "wait" would definitely lead Windows to decide that it could "demote"
the Excel process.

I've tried all kinds of things to disable this "feature" but so far have not had
any luck.

If you should happen to come across something, let me know!!!

good luck,
 
Paul
-----------------------------------------
"Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can." - John Wesley
-----------------------------------------

________________________________
From: Torstein Johnsen <sejohnse@yahoo.no>
To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
Sent: Wed, November 28, 2012 4:11:14 AM
Subject: Vedr: [ExcelVBA] Re: counter problem

 
Thank you to Paul and Hafizullah!
 
I'm using Excel 2010 and windows 7.
 
I have never been aware of this "helpfullness" by Excel/Windows trying to
understand what we "are not doing"!!?
 
And I suspect that you have pointed on the problem.
 
After some trying and failing I have given it up, I was not able to adjust how
excel handled the pauses. .
 14
I thought perhaps using the API sleep function in Windows could solve the
problem, but NO. Putting in SLEEP-pauses for more than a second or two makes
EXcel hang.

 
So far I've figured ou that application.wait causes no problems, but it can not
make pauses for less than a second.

 
Thank you again!
 

[Non-text portions of this message have been removed]

74

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar