screen refresh in VBA animation

G

Guest

I have a VBA code resulting in an animation (say, showing a vibrating string).

The code works in slide show mode if I have a MsgBox included in the
animation loop, which of course I cannot have in the final version. Without
it, the screen is not refreshed while the animation loop is executed in the
background. After a while of a blank screen the last shape of the animation
is displayed.

Is there a way of forcing a screen refresh from within a loop?

This follows my previous querries on animation using math posted on Feb. 16.

Again, many thanks for all previous hints and avises.

JanAdam
 
S

Steve Rindsberg

I have a VBA code resulting in an animation (say, showing a vibrating string).

The code works in slide show mode if I have a MsgBox included in the
animation loop, which of course I cannot have in the final version. Without
it, the screen is not refreshed while the animation loop is executed in the
background. After a while of a blank screen the last shape of the animation
is displayed.

Is there a way of forcing a screen refresh from within a loop?

If adding DoEvents statements at appropriate spots doesn't do the job, you can
force a refresh by GoToSlide(the-current-slide):

Sub GoToMe()
Dim lSlideIndex As Long
lSlideIndex = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
ActivePresentation.SlideShowWindow.View.GotoSlide (lSlideIndex)
' You could combine eliminate the variable and combine the two
' statements but this is easier to read
End Sub
 
J

Jan

Thanks Steve again. I will try it tomorrow but I can see it has to work. Do
you think anybody can benefit from my code once it's finished? I am so much
on the receiving end of various groups that I would like to start paying
back.

JanAdam


 
W

Wicked Wizard

Yes Jan, I can for one! There is nothing like enough good stuff out there
on PPT VBA and every contribution helps.

WW

Jan said:
Thanks Steve again. I will try it tomorrow but I can see it has to work.
Do
you think anybody can benefit from my code once it's finished? I am so
much
on the receiving end of various groups that I would like to start paying
back.

JanAdam
 
D

David M. Marcovitz

Jan,

If you can get this wacky thing to work (and it looks like you're pretty
close), I would love to post it on my site. I have a section named
"Examples From Real People" where I would be happy to post your completed
project. You can see the other examples at my site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Most of the "Examples From Real People" are projects that my students
(who are mostly teachers) have done, but I'm happy to post examples from
anyone.

If you would be willing to let me post your project, just send it to me
via email at (e-mail address removed) (just remove the NOSPAM). Just note
that if you are sending it as a .zip file, rename the extentions to .zp
to fool my SPAM blocker into not blocking it. Also include a brief
description (one paragraph) of the project that I can include on the
site.

Thanks.

--David
--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
S

Steve Rindsberg

Thanks Steve again. I will try it tomorrow but I can see it has to work. Do
you think anybody can benefit from my code once it's finished? I am so much
on the receiving end of various groups that I would like to start paying
back.

That'd be neat. I don't know that I've seen any good examples of plotting
curves in code. Do you have a site where you can post an example presentation?

[later]

I see that David's already offered a home for it. Perfect!
 
G

Guest

I have it working ok now. Two harmonics at a time. I have to add decays,
which is only math, no VBA problems. Define the function outside the main sub
to make it more modular, clean it up, comment, etc. I will send it to David,
probably during the weekend.

Steve, your DoEvents worked. Thanks again for helping solving the crucial
point. I was close to giving up.

JanAdam



Steve Rindsberg said:
Thanks Steve again. I will try it tomorrow but I can see it has to work. Do
you think anybody can benefit from my code once it's finished? I am so much
on the receiving end of various groups that I would like to start paying
back.

That'd be neat. I don't know that I've seen any good examples of plotting
curves in code. Do you have a site where you can post an example presentation?

[later]

I see that David's already offered a home for it. Perfect!
 
S

Steve Rindsberg

I have it working ok now. Two harmonics at a time. I have to add decays,
which is only math, no VBA problems. Define the function outside the main sub
to make it more modular, clean it up, comment, etc. I will send it to David,
probably during the weekend.

Steve, your DoEvents worked. Thanks again for helping solving the crucial
point. I was close to giving up.

I'm delighted to hear it! And looking forward to seeing the results.
 

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