Word 2010 with Vs2010 Add-in - Optimization RRS feed

  • Question

  • I moved all my code from templates to a vs2010 Add-In.
    I have the routines running but they take about twice as long
    when running from the Add-In.

    I turn ScreenUpdating to False.

    One of my routines (DocEval) performs a wide variety checks on a document.

    I have noticed that a subroutine called towards the end of DocEval takes
    152 seconds, but if I only run it by itself it only takes 3 seconds.

    I have tried including doc.UndoClear before calling the subroutine,
    but it does not seem to help on the time.

    Any suggestions will be appreciated.


    Monday, July 29, 2013 5:18 PM

All replies

  • Hi TBS_Shaf,

    I think you can add some code like 'Debug.print Time' in your code help you find which cost you plenty of time. 

    Wednesday, July 31, 2013 12:09 PM
  • Bruse,

    Thanks for the reply.

    Yes, I use debug.print with a stopwatch to identify the time required for
    each sub-routine.

    My question is more specific to why does a routine take significantly longer
    when called after other routines rather than before them. I suspect it may
    have something to do with memory and would like to know how to work around

    Thanks Again,


    Wednesday, July 31, 2013 1:05 PM