Answered MS Project VBA - Equivalent of Echo Off

  • Thursday, April 12, 2012 3:30 PM
     
     

    Is there an equivalent to "Echo Off" in MS project VBA to prevent the screen repainting during execution of code?

    I've got a bit of code which applies conditional formatting to tasks in the Gantt View, and it works really well apart from the migraine inducing flicker when code swaps between views/applies filter.

    (This code is specifically for MS Project 2007, although Id be interested to know for other versions too.)

All Replies

  • Thursday, April 12, 2012 9:28 PM
     
     

    Andrew,

    I assume by "conditional formatting" you mean customized font characteristics. Unlike some other Office applications (e.g. Excel), font formatting in Project can only be done using foreground processing. That is, the user must select an item in the active view to apply the formatting. Since the screen must be "active" to make the selection, there is no way to "turn off" the screen during this process.

    Filters on the other hand can be applied using background processing, meaning that a filter can be applied to project data without the data actually being displayed.

    Depending on how much formatting you are using you may be able to minimize the visual disturbance by formatting groups of data at one time, equivalent to using multiple selection when manually editing.

    One final thought, Project does have an application level property called ScreenUpdating. I don't think it will help in your scenario but you could try it

    Application.ScreenUpdating = false

    John


  • Sunday, April 15, 2012 3:27 AM
    Moderator
     
     Answered
    Application.ScreenUpdating = should do it. Application.ScreenUpdating = True to restore screen updates: same as in Excel.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management

    • Marked As Answer by Andrew Simpson Monday, April 16, 2012 8:03 AM
    •  
  • Monday, April 16, 2012 8:05 AM
     
     

    Thanks both.

    With this and a couple of other tweaks I've managed to reduce the flicker down to a tolerable level - although can't get rid of it completely due to the constraint John has highlighted.