News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Spinning Shapes using the ShapeSheet and VBA Code

Started by shannonl, November 03, 2011, 12:44:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shannonl

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.

vojo

#1
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.

aledlund

#2
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

vojo

#3
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

shannonl

#4
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

vojo

#5
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.

shannonl

#6
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?

Jumpy

#7
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


Sub Document_Opened()

End Sub


Inside that place a call to start your macro, for example:

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.

shannonl

i tried that...it didnt seem to work...do you offer any training?

Paul Herber

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 for Visio -

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

Jumpy

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

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

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 347 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1224KB.
Tokens: post-login.
Cache hits: 13: 0.00185s for 26,728 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]