How to boost priority on Excel automation instance

Rx_

Nothing In Moderation
Local time
Yesterday, 23:20
Joined
Oct 22, 2009
Messages
2,803
Is ther a way to boost the priority thread for an instance of Excel.exe during Access automation? (vba)

Access 2010 front-end with SQL Server 2008 back-end is running fast and smooth on a Citrix server. Each user session creates a copy of the Access DB so each user is running their own front-end exclusivelly.

The many reports grab data very quickly, create an instance of Excel 2010 (32bit) and format them. Performance Monitoring shows Excel is not taking advantage of the massive processors / RAM available.

On my development workstation, halt the code, use task manager to give Excel.exe a one level boost in priority and continue results in an almost doubling of performance. Is there any code in vba that can boost Excel's thread? An idle processor is a terrible thing to waste.
 
Excel Automation - used for reports on Windows Server:

This code is reported to boost the priority thread on all Excel running on the server, not just the instance called. I guess that would be OK since dozens of users only use Excel for dozens of reports.

My desktop (not all that new of a computer) can run the automation across the network (not all that fast of a network) faster than the Access EXE can run on the same Windows Server calling Excel EXE. The process threads are not all that high of percents.

Here is what I found, will maybe try it later today:
Code:
Sub SetPriority()
 
    Const ABOVE_NORMAL = 32768
    Const HIGH = 128
 
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _
        & strComputer & "\root\cimv2")
    Set colProcesses = objWMIService.ExecQuery _
        ("Select * from Win32_Process Where Name = 'excel.exe'")
    For Each objProcess In colProcesses
        objProcess.SetPriority (HIGH)
    Next
 
End Sub
 

Users who are viewing this thread

Back
Top Bottom