Animation Using Visio & VBA

M

MikeM

I'd like to move an icon (named shIcon) from point A to B, and I can do so by
adding in a 1-second delay between moves. The way I've done it is:

With shIcon
dx = 0.1 * (xLoc - .Cells("pinX"))
dy = 0.1 * (yLoc - .Cells("pinY"))
For i = 1 To 10
dt1 = Now + 1 / 86400
' Next 3 lines create a 1-second delay (not the best way to do it, but it
works)
Do Until Now >= dt1
dx = dx
Loop
.Cells("pinX") = .Cells("pinX") + dx
.Cells("pinY") = .Cells("pinY") + dy
Next i
End With

However, I don't see the icon moving across the page, since it just shows
the first and last points. How can I make the move visible?

TIA,
Mike
 
M

MikeM

Thanks, Andy. Is there any way of programming in a delay other than the
kludge-y way I've done it?

Mike
 
J

John Marshall, MVP

With VBA, there is no easy way to set upa timer.

Graham Wideman's book, Visio 2003 Developer's Survival Pack, has a chapter
on animation and provides a VSL to help with the timing.

If you are getting seriously into Visio development, DVS (Developing Visio
Solutions from Microsoft Press/MSDN) and Graham's book are must haves.

John... Visio MVP

Need stencils or ideas? http://visio.mvps.org/3rdparty.htm
Need VBA examples? http://visio.mvps.org/VBA.htm
Visio Wishlist http://visio.mvps.org/wish_list.htm
 
M

MikeM

Thanks, John. I'll get it.

Mike

John Marshall said:
With VBA, there is no easy way to set upa timer.

Graham Wideman's book, Visio 2003 Developer's Survival Pack, has a chapter
on animation and provides a VSL to help with the timing.

If you are getting seriously into Visio development, DVS (Developing Visio
Solutions from Microsoft Press/MSDN) and Graham's book are must haves.

John... Visio MVP

Need stencils or ideas? http://visio.mvps.org/3rdparty.htm
Need VBA examples? http://visio.mvps.org/VBA.htm
Visio Wishlist http://visio.mvps.org/wish_list.htm
 

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