Hi Paul,

I don't know the answer to your whole question, but using DoEvents
periodically should ensure you can interrupt the macro, that screen painting
can occur, and that the Excel application window can respond to events.
Perhaps issue this at the same time as your statusbar update.

 

Windows has a built-in scheduling feature that gives a boost to foreground
processes.  You can disable that feature (Advanced System Settings
>Performance Settings > Advanced > Processor Scheduling > Adjust for best
performance of: Change from "Programs" to "Background services" (which just
disables the foreground boost).  A side effect is that every non-foreground
window will now get more processor time than before, including system
services.  This could cause a general slowdown.  But it might work for you,
especially if you also raise the priority class of the Excel process to
Above Normal or High.

 

Asa

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Paul Schreiner
Sent: Friday, October 26, 2012 5:22 AM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Excel 2010 VBA Priority

 

I have macros that run for several minutes (usually updating an Oracle
database)

I update the StatusBar to indicate progress, like:

 

if (nRec mod 1000 = 0) then Application.Statusbar = "Processing " & nRec & "
of " & nRecordCount

 

I've noticed that after a few cpu cycles, Excel goes into "Background".

this also happens if I switch to a differnet application while the macro is
running

(like checking my email)

While in "background", the macro takes longer to run, and it won't let me
interrupt the macro.

 

In Excel 2003, you could go to Windows Task Manager and change the Window
Priority.

I found VBA code that accomplished this and used it in my VBA macros for
years.

 

In Excel 2010, this not longer accomplishes the same requirement.

 

Does anyone know of a way to force Excel and VBA to stay in "Foreground
Processing"?

 

thanks,

 

Paul

-- 
Join official facebook page of this forum @
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups
"MS EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to
excel-macros+unsubscr...@googlegroups.com.
 
 

-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES (1120+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

6) Jobs posting is not allowed.

7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.


Reply via email to