VBA - Delay in clearing option buttons

J

John Michl

I have a simple macro that runs through the presentation and sets the
value of all option buttons to False. Though the code works, I get
an eight second delay AFTER the final message box before I get mouse
control. So the user thinks the process is done but doesn't get
control for eight seconds. What is going on? Is there a faster way
to clear the buttons? Code is below. I get the final message box
almost instantly but then the delay after clicking the button. It
doesn't matter how long I wait to click. I still get an eight or so
second delay. Thanks.


Sub ClearAllValues()

Dim oSld As Slide
Dim oShp As Shape

i = 0
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoOLEControlObject Then
i = i + 1
'If oShp.OLEFormat.Object.Value = True Then
oShp.OLEFormat.Object.Value = False
End If
Next oShp
Next oSld

MsgBox "Reset is complete. Objects found: " & i

End Sub
 
D

David Marcovitz

That's weird. I wonder what would happen if you commented out the line
that sets the value to False. Do you still get an 8-second delay. I
can't figure out why this would happen so I'm just trying to suggest a
debugging idea.
--David
 
J

John Michl

Yes, David. I've tried that. Actually, it appears that the code I
pasted in this message had that commented out. When commented out, it
runs lightening fast and I get control back immediately. However,
after updating those controls, it seems like it fires the final msgbox
before it is done updating the controls and the pressence of the
message box makes it pause. When I click ok, the message box
disappears and is replaced by a black box for eight to ten seconds.

Not sure I mentioned but I'm using PPT 2007.

- John
 
J

John Michl

Steve -
SP1 is installed (took me forever to figure that out! What happened to Help > About?)
Code runs in slideshow mode
34 slides have 15 radio buttons each for a total of 510 controls

Not I confirmed that the code does run instantly but it doesn't give
mouse control back. I placed a GotoSlide command in the code directly
below the finishing message box. That command takes me to the final
slide where I can see before pressing the OK that the controls have
already been reset.

This presentation was originally created in PPT 2003 and then
converted. Could that have anything to do with the problem?

FYI - a new oddity popped up this morning which I'll post separately.

- John
 
J

John Michl

Beep doesn't beep at all for me. In fact, I used the simple sub in
the help to test my beeper and heard nothing. Here's that code:
Sub BeepMe()
Dim I
For I = 1 To 3 ' Loop 3 times.
Beep ' Sound a tone.
Next I
End Sub

I confirmed that my volume was not muted and was turned up.

However, I'm pretty sure things are firing at the correct time. As I
mentioned in a previous post, I added a statement that would go to one
of the slides with controls before the message statement so I could
visibly see if the controls had been reset. They had been reset. So
it seems like the work is done but the mouse control isn't given back.

- John
 
J

John Michl

It's amazing how they can pack so many bad practices into just a few lines.
But that's neither here nor there ... it should still produce a single beep.
Let's not let that distract us, though.  I've had a PC or two that wouldn't  
Beep; never did sort out why.


Understood.  I can repro something similar by using Insert Slides From
Outline and picking a large text file.  It appears to be done but the mouse
doesn't return.  Trying to repro it in code is another exercise in
PPT2007Frustration.  Code that works in 2003 and prior produces nonsensical
errors in 2007.  

Some formatting/visual changes can be VERY slow in 2007; I suspect you're
running into something along those lines.  It may have finished runningthe
code that provokes the changes but until its done updating internally, it's
not returning control to the user.









==============================
PPT Frequently Asked Questionshttp://www.pptfaq.com/

PPTools add-ins for PowerPointhttp://www.pptools.com/- Hide quoted text -

- Show quoted text -


Here's an interesting twist. Not sure if it helps or muddies the
water.

When I run the code, I get to the message box almost immediately (1
second?) and after I press the OK in the message box, it takes another
8-10 seconds for me to get my mouse control back. An associate has a
different experience. He kicks off the macro and it take 8-10 seconds
before he gets the message box. When he clicks ok, he gets control
back in a second or two.

- John
 

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