- Thread Author
-
- #1
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?
How can I increase the priority of Excel in the scheme of things so that this doesn't happen?
Solution
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.
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.
- Joined
- May 16, 2010
- Messages
- 5,703
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).
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).
- Joined
- May 16, 2010
- Messages
- 5,703
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.
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.
- Thread Author
-
- #5
So, I can run your suggested bat in the following vba code...
Does this look right to you?
Steve
-------------------------------------------------------------------------------------------------------------
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.
- Thread Author
-
- #6
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".
Steve
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
Similar threads
- Replies
- 0
- Views
- 65