Author Topic: Spinning Shapes using the ShapeSheet and VBA Code  (Read 7543 times)

0 Members and 1 Guest are viewing this topic.

shannonl

  • Jr. Member
  • **
  • Posts: 12
Spinning Shapes using the ShapeSheet and VBA Code
« on: November 03, 2011, 07:44:31 AM »
i have a shape that has some code in the shapesheet telling it to spin.  What i need is the shape to spin when a textbox on my drawing says on and for it not to spin when the text says off. 

Does anyone know how to make this happen?  I can upload the shape if anyone wants to take a look at it.   I will be willing to pay if someone would like to help me with this.

Thanks in advance.
« Last Edit: November 08, 2011, 04:58:58 AM by Visio Guy »

vojo

  • Hero Member
  • *****
  • Posts: 1710
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #1 on: November 03, 2011, 08:01:34 AM »
do you mean rotate  or actively spinning.....would be curious to see it if the latter

cells could be

user.text = "<On or Off>
user.trigger = if (strsame (user.text, "On"), 1, 0)

the cell to cause spinning = if (user.trigger, <spin>, <dont spin>

In the text box....select insert field....pick user text

If you want to change user.text value...then use the properties cells.....put docmd(1312) in the double click event cell.
« Last Edit: November 08, 2011, 04:59:05 AM by Visio Guy »

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #2 on: November 03, 2011, 09:51:07 AM »
animation cannot be accomplished by just the shapesheet, it requires something to kick it off (i.e. timers which are only available via code).
al
« Last Edit: November 08, 2011, 04:59:37 AM by Visio Guy »

vojo

  • Hero Member
  • *****
  • Posts: 1710
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #3 on: November 03, 2011, 02:58:41 PM »
I know that....I was wondering if he wants text trigger some VBA....and if so, real curious to see that since I played with animation about a year ago
« Last Edit: November 08, 2011, 04:59:43 AM by Visio Guy »

shannonl

  • Jr. Member
  • **
  • Posts: 12
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #4 on: November 04, 2011, 07:37:05 PM »
thanks for the replies...would either of your be interested in taking a look at the shape and see if you can get it to turn..I would be willing to pay if anyone would like to take a look at it.

Thanks
« Last Edit: November 08, 2011, 04:59:12 AM by Visio Guy »

vojo

  • Hero Member
  • *****
  • Posts: 1710
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #5 on: November 05, 2011, 12:11:20 PM »
post an example here.

if it gets too complicated, somebody will ask for money or give up ....most times its a 15 min exercise to figure out what needs tweaked...so pretty much all done here for free.
« Last Edit: November 08, 2011, 05:01:07 AM by Visio Guy »

shannonl

  • Jr. Member
  • **
  • Posts: 12
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #6 on: November 07, 2011, 03:52:07 PM »
I figured out how to get my shape to turn using code and running a macro.  I need this shape to turn only when a textbox on my drawing says "ON".  The textbox displays live data.  I can get it to work when i run the macro, but when i put the drawing on our server i'm guessing the code isn't getting ran because nothing is telling it to run.  Is there code that i could run the macro when drawing is loaded?
« Last Edit: November 08, 2011, 04:59:20 AM by Visio Guy »

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #7 on: November 08, 2011, 02:28:12 AM »
In the VBA project of the drawing, go to "ThisDocumnet" modul.
In the Dropdown boxes over the editor window select Document (left) and OnOpen (right).
This creates an empty VBA Macro

Code
Sub Document_Opened()

End Sub

Inside that place a call to start your macro, for example:
Code
Sub Document_Opened()
  Dim shp as Shape
  For  each shp in ActivePage.Shapes
    MyMacro(shp)
  Next shp
End Sub

----------------------------
If you want the code to run, whenever the text is changed to "on" you can place CALLTHIS("MyMacro") in the Textevent cell in the event section of the shapesheet of each shape.
« Last Edit: November 08, 2011, 04:59:27 AM by Visio Guy »

shannonl

  • Jr. Member
  • **
  • Posts: 12
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #8 on: November 08, 2011, 08:49:43 AM »
i tried that...it didnt seem to work...do you offer any training?

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3369
    • Paul Herber's website
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #9 on: November 08, 2011, 09:53:38 AM »
It would be really neat if Visio allowed inserted animated GIFs to run. A Run/Stop toggle on its menu would solve any performance problems.


Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #10 on: November 08, 2011, 09:55:31 AM »
Maybe you could upload your On - Off Shape and the code you've tried so far.

And for a non native english speaker like me please an explanation what you really want to happen, because I'm not certain, that I understand what you mean, when you talk about spin/rotate a shape by 90 deg.
Do you want it to rotate one time to 90° if the text is "On" or do you want it to rotate continiuosly every half second or so for 90°?

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4838
  • Ideas Visio-lized into solutions
Re: Spinning Shapes using the ShapeSheet and VBA Code
« Reply #11 on: November 08, 2011, 12:06:01 PM »
Don't know if this will help, but here's an animation that triggers from a run & stop button. 

Ferris Wheel: demonstrating shape dependency
http://visguy.com/vgforum/index.php?topic=1046.msg4590#msg4590

Scroll toward the bottom to get the animated version.

Wapperdude
Visio 2019 Pro