Windows 7 System Priority

sdruley

New Member
I have an important app running in Excel that takes 7 hours to complete. During that time the focus of the app is somehow diverted to something else in the Windows environment. When this happens the Excel program stops in its tracks until I click on it to give it back the focus.
How can I increase the priority of Excel in the scheme of things so that this doesn't happen?
 
You can do but be aware that it can cause stability problems:

1. Open task manager (Ctrl/Shift/Esc).

2. Right click the application you want to prioritise, "Go to Process."

3. Right-click the process, "Set Priority". Choose from the range "realtime" (highest) to low (lowest).
 
Pat,
Your response was timely and professional. I would like to know if there is a way to set up a bat file to do the above.

Steve
 
You could use the start command in a batch file using this format:

start /priority path

where priority is one of the range given above (realtime to low) and path is the full address of the application, eg:

start /high %windir%\system32\notepad.exe

would run the notepad utility with a priority of high.

In this case call the batch file something like runNotepad.bat.
 
So, I can run your suggested bat in the following vba code...

Code:
Sub ExecuteBAT()Dim wshThisShell As WshShell
Dim lngRet As Long
Dim strShellCommand As String
Dim strBatchPath As String
Set wshThisShell = New WshShell
strBatchPath = "start /high %windir%\C:\TTND\Picasso.xlsm"
strShellCommand = """" & strBatchPath & """"
lngRet = wshThisShell.Run(strShellCommand, vbNormalFocus, vbTrue)
End Sub

Does this look right to you?

Steve


-------------------------------------------------------------------------------------------------------------
You could use the start command in a batch file using this format:

start /priority path

where priority is one of the range given above (realtime to low) and path is the full address of the application, eg:

start /high %windir%\system32\notepad.exe

would run the notepad utility with a priority of high.

In this case call the batch file something like runNotepad.bat.
 
Pat, I now have the following; but I am still getting the run time error -2147024894 (80070002) Automation error at the last line of code: "The system could not find the file specified".

Code:
Sub ExecutePriorityBAT()Dim wshThisShell As WshShell
Dim lngRet As Long
Dim strShellCommand As String
Dim strBatchPath As String
Dim strShellSubCommand As String
Set wshThisShell = New WshShell
strShellSubCommand = "start  /high"
strBatchPath = "C:\Program Files\Microsoft Office\Office14\Excel.exe"
strShellCommand = """" & strShellSubCommand & strBatchPath & """"
lngRet = wshThisShell.Run(strShellCommand, vbNormalFocus, vbTrue)
End Sub

Steve
 
Back
Top