none
MS-Project Performance: VBA vs VSTO vs COM-Interop RRS feed

  • Question

  • Dear reader,

    I am manipulating my mpp's a lot. 

    For doing this, I usually develop a "standard .Net-C#-Desktop-CommandLine-Executable" , I open the mpp's and I perform what I need via:  COM-Interop. The performance is quite low ( I have some thousands of worckpackages accumulated over the years)

    Now I believe to observe, that "Macro-like-VBA", running inside Ms-Project executes a lot faster.

    I also believe to observe, that VSTO-based Plugins are running faster than my "good-old-com-interop-progs".

    Can you give me a hint: What is faster?   VBA   vs    VSTO    vs  COM-Interop

    Thank you in advance



    • Edited by Somigur Friday, November 18, 2016 7:23 PM
    Friday, November 18, 2016 6:10 PM

Answers

  • Hi,

    The basic difference between VSTO and the standalone app is that a VSTO app is an add-on for Project and its code is run from buttons on Project's Ribbon.

    So if you still want to run from a command line or direct from Windows then stay as you are.

    Otherwise VSTO is neater and integrates into Project and can include everything you want from Visual Studio. However VSTO add-ins are specific to different versions of Project, but with VS 2015 one add-in can handle 2013 and 2016.

    Add-in Express (https://www.add-in-express.com/add-in-net/index.php) is a tool you can buy that lets you write one add-in that can work with any version of Project.

    Yes VBA is fastest because although the code is interpreted line by line as it executes, it runs in the same process as Project. COM and VSTO run in their own windows process and there is a high overhead for all inter-process activities (like reading project data etc.).

    I recommend using VB.Net for VSTO. Get what you want working in VBA first then its an easy port to VBA.Net.


    Rod Gill
    Author of the one and only Project VBA Book and VBA developer.
    www.project-systems.co.nz

    Saturday, November 19, 2016 12:32 AM
    Moderator

All replies

  • Somigur,

    Simple answer. If you are manipulating Project files then VBA will always be the fastest approach. Why? Because VBA is resident within the Project application and therefore is not slowed down by system "overhead" as is the case with processes running outside the application.

    Hope this helps.

    John

    Friday, November 18, 2016 6:41 PM
  • Hi John, thank you.

    What's about VSTO?  Is it using COM-Interop also under the hood?

    Friday, November 18, 2016 6:47 PM
  • Somigur,

    I don't have any first hand experience with VSTO but my understanding is that VBA will run the fastest. But it depends on how fast you need your process to run. You might do a test using a procedure entirely in VBA and another using an add-in created with VSTO. Test both on a file representative of what you need and see which give the best performance. If you are more comfortable with VSTO and find that it runs fast enough, then that's the answer for you.

    John

    Friday, November 18, 2016 8:11 PM
  • John,

    yes , I think VBA is fastest. But I do not want to switch to VBA, because I have really big exe running with a lot of business-logic.  With my "external-console-com-interop" approach I have the full power of architecture/design available to manage a big project.

    I will probably get lost, if I try to program this in VBA.

    So, effectively, the questions are reduced to:

    "Is there a performance difference between the VSTO-approach and the "external-com-interop"-approach?

    Friday, November 18, 2016 9:08 PM
  • Somigur,

    Have you considered switching to Project Server? It is specifically designed to help organizations manage their projects at en enterprise level. I don't do Project Server so I can't give you pros and cons but if your interested you might consider posting to the Project Server forum at:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=projectserver2010general

    With respect to VSTO or "external-com-interop" I'm afraid I can't help you with that but let me ping someone who I think can answer your question and ask him to jump in to this thread.

    John

    Friday, November 18, 2016 11:23 PM
  • Hi,

    The basic difference between VSTO and the standalone app is that a VSTO app is an add-on for Project and its code is run from buttons on Project's Ribbon.

    So if you still want to run from a command line or direct from Windows then stay as you are.

    Otherwise VSTO is neater and integrates into Project and can include everything you want from Visual Studio. However VSTO add-ins are specific to different versions of Project, but with VS 2015 one add-in can handle 2013 and 2016.

    Add-in Express (https://www.add-in-express.com/add-in-net/index.php) is a tool you can buy that lets you write one add-in that can work with any version of Project.

    Yes VBA is fastest because although the code is interpreted line by line as it executes, it runs in the same process as Project. COM and VSTO run in their own windows process and there is a high overhead for all inter-process activities (like reading project data etc.).

    I recommend using VB.Net for VSTO. Get what you want working in VBA first then its an easy port to VBA.Net.


    Rod Gill
    Author of the one and only Project VBA Book and VBA developer.
    www.project-systems.co.nz

    Saturday, November 19, 2016 12:32 AM
    Moderator