+ Reply to Thread
Results 1 to 4 of 4

Setting Multi-Threaded Calculation To 3 Processors Using Add-In?

  1. #1
    Registered User
    Join Date
    03-17-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Setting Multi-Threaded Calculation To 3 Processors Using Add-In?

    Hey,

    Recently the company I work for moved onto Citrix and we found unless you limit the number of processors that Excel can use you can end up with performance issues. We believe the performance issues are caused by Excel taking system resource away from the network controller on the virtual PC and causing lookups to essentially hang Excel. So I want to set the number of processors Excel can use to 3 which leaves 1 alone, when we do this for users who are having troubles this has always fixed the issue. However as Microsoft wont let currently control the number of processors used by Excel with group policy or registry the only option I have found is using an Excel add-in which I found on this website: http://www.remkoweijnen.nl/blog/2012.../#comment-5633

    Below is the code I am using in my add-in, which works perfectly for any new documents which are created in Excel. My problem is I can't get the add-in to apply to existing documents and I can't understand why. I have saved the add-in as an XLA file and placed it into the C:\Program Files\Microsoft Office\Office14\XLSTART folder. If I open the existing document and then double click the add-in, then it applies I just can't get it to run automatically.

    Private Sub Workbook_Open()
    ' Manual Mode '
    Application.MultiThreadedCalculation.ThreadMode = xlThreadModeManual

    ' Use 3 CPU '
    Application.MultiThreadedCalculation.ThreadCount = 3
    End Sub
    Cheers,

    John

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Setting Multi-Threaded Calculation To 3 Processors Using Add-In?

    I assume the Workbook_Open event is that of the addin.

    You need to include a app event listening class that checks and sets the value when any workbook is opened.
    http://www.cpearson.com/Excel/AppEvent.aspx
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    03-17-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Setting Multi-Threaded Calculation To 3 Processors Using Add-In?

    Thanks Andy,

    After doing some testing I worked out the problem was the event was running before the workbook opens. This changed the setting, but when the workbooked opened it changed the setting back. So we added two additional events to cover all eventualities.

    Private WithEvents App As Application

    Private Sub App_NewWorkbook(ByVal Wb As Workbook)
    ' Use 3 CPU Threads'
    Application.MultiThreadedCalculation.ThreadCount = 3

    End Sub

    Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
    ' Use 3 CPU Threads'
    Application.MultiThreadedCalculation.ThreadCount = 3

    End Sub

    Private Sub Workbook_Open()
    Set App = Application
    ' Use 3 CPU Threads'
    Application.MultiThreadedCalculation.ThreadCount = 3

    End Sub

  4. #4
    Registered User
    Join Date
    06-24-2014
    Location
    Kent, England
    MS-Off Ver
    2003 2010
    Posts
    1

    Thumbs up Re: Setting Multi-Threaded Calculation To 3 Processors Using Add-In?

    There is a simpler and more effective solution for RDS/TS environments.
    Look for a free application called Thread Locker.
    Its a dotnet app that runs as a service and allows you to set processor affinity on the fly for a specific process or processes.
    This was a life saver for me at one time but I suspect it is more commonly needed as apps become multi core processing capable.
    Hope this helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1