Can I "Freeze" the display while loading data?

E

Evan S. Dictor

I have written a plug-in for Project from an external application that can
often load thousands of tasks. To me it seems that there is a huge slowdown
as Project updates the display constantly as these tasks are added. Is there
a way to freeze Project's display during this process and then allow it to
only update at the end?

Thanks in advance,
Evan S. Dictor
 
E

Evan S. Dictor

Unfortunately, this just minimizes the application.

I seem to remember in Excel there was a way to Freeze the display in a way
that would allow large changes to be made without taking the time to update
the complete display after each individual change. The end result often was a
huge performance increase.

Evan S. Dictor
 
B

Bill B

Try this at the begining:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String)
As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As
Long) As Long

Public Sub FreezeScreenUpdating(sWindowCaption As String)
Dim lHwnd As Long
Dim lReturnVal As Long
lHwnd = FindWindow(vbNullString, sWindowCaption)
lReturnVal = LockWindowUpdate(lHwnd)
DoEvents
End Sub

where sWindowCaption is Application.Caption.

And don't forget to call this at the end:

Public Sub UnFreezeScreenUpdating()
Dim lReturnVal As Long
lReturnVal = LockWindowUpdate(0)
DoEvents
End Sub

Sometimes it works, sometimes not. Make sure you turn off auto-calc as well.

Bill B
 
J

John

Evan S. Dictor said:
Unfortunately, this just minimizes the application.

I seem to remember in Excel there was a way to Freeze the display in a way
that would allow large changes to be made without taking the time to update
the complete display after each individual change. The end result often was a
huge performance increase.

Evan S. Dictor

Evan,
You are right, Excel has a "DisplayUpdating" property that can be set to
false. Unfortunately Project VBA does not have that property - unless
it's been added in the Project 2007 object model - I haven't checked.

John
Project MVP
 
R

Rod Gill

Hi,

Yes Screenupdating is in Project 2007 and 2003.

Try:
Application.Screenupdating=false

and

Application.Screenupdating=True

You need to remember the =true at the end of your macro!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
B

Bruce McF

Application.ScreenUpdating =True or False (to toggle) has worked to deliver
what I believe is the desired behaviour in similar applications for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top