How to disable TreeView screen update?

  • Thread starter Thread starter baobob
  • Start date Start date
B

baobob

Relative newbie Q:

I have a process that goes thru an Excel 2002 TreeView and moves 'n
prunes a lot of Nodes.

Even though I (don't think I'm) actually selecting the Nodes I'm
working on (I never use .SelectedItem), still the whole tree insists
on visually updating in real time to reflect every change, resulting
in ungodly (and time-consuming) visual churn.

I cannot find a ScreenUpdate property in TreeView (or in any VBA
control, for that matter). And setting:

- TreeView.Enabled
- Application.ScreenUpdating

to False fail to stop it.

What property do I use?

Thanks much.

***
 
Try preventing the repaint with the Windows API:

'this goes at the top of the module or at the top of the form code
'---------------------------------------------------------------------------
Private Const WM_SETREDRAW = &HB
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As _
Long, ByVal wParam As Long, lParam As Any) As Long

'this goes in your procedure
'--------------------------------
With TreeView1
SendMessage .hwnd, WM_SETREDRAW, 0, 0
'run your treeview code here
SendMessage .hwnd, WM_SETREDRAW, 1, 0
End With


RBS
 
Back
Top