View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default Showing/Hiding shapes

Maybe try inserting the line

DoEvents

Right before Application.ScreenUpdating = False

I don't know why, but sometimes it makes a difference.

Hth

-John Coleman






On Apr 1, 7:16 pm, "Ferris" wrote:
I am experiencing some odd behavior in some of my VBA and I'm hoping
someone can help me out. I have a rectangle on my sheet that I'm
trying to toggle on and off during a long VBA process to let the user
know something is happening in the background. My code is below:

Sub BuildAll()
Call DoIt("Rectangle 1", True) 'Make the updates are in progress
message appear
Application.ScreenUpdating = False
Call BuildSubj
Call BuildAud
Call BuildCert
Call BuildCat
Application.ScreenUpdating = True
Call DoIt("Rectangle 1", False) 'Make it disappear
End Sub

Sub DoIt(ShapeName, Vis)
ActiveSheet.Shapes(ShapeName).Visible = Vis
End Sub

The odd thing is that if I step through the BuildAll (using F8), the
rectangle appears and disappears like I would expect. If I just run
the BuildAll sub the rectangle never appears.

Any thoughts on this?