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

SHAPE NAME ON DROP

Started by DAVEDEWEY, September 13, 2016, 11:10:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DAVEDEWEY

Good afternoon, Ive created a set of shapes of which there will be a number dropped onto the page. Visio gives a unique ID usually sheet something I believe this then forms part of the code if you wish to address through VBA

Is there an easy example or tutorial any one can point me to so that each time i place a shape on the page im prompted to give that shape an id 

vojo

be careful...if you do the following

- drop a shape 1 of type A  (square)
- do something with VBA
- delete shape 1
- drop a shape 2 of type B (oval)
- do something with VBA

Turns out shape 2 has the name that shape 1 had before deleted  (sheet.1)

You  are better off using a user cell and eventondrop cell

user name cell = name + user cell
user number cell

eventondrop = setf(getref(user cell), name + (user number cell + 1))

I am sure the format of the commands is not 100%....but you get the idea
This would guarantee uniqueness and by family abilities

Otherwise, you will have to interrogate the shape to determine if its a square or oval
Or you have to get into the WW unique name of the shape - essentially does the same sort of thing as above.
(which has to be pulled visio...not presented as part of shape).


vojo

my bad....need something a bit more elegant than "number cell + 1"....
But the overall point is valid:  Name alone does not guarantee uniqueness over time or action.

AndyW

You can use UniqueId from VBA, will give a unique GUID for a shape
Live life with an open mind

Yacine

The question is: what do you intend to do with that id?
If you're just trying to retrieve the shapes dropped, then you could either go for the master or set a custom property identifiying the shape.
Yacine

Nikolay

As of my understanding (from the previous topic you started), you are trying to avoid modification of the code generated by macro recorder, so that this code can be directly used for the shape that is dropped? If so, it does not seem to be possible... You absolutely have to modify that code it to make usable.. And that assumes that you'll need some understanding of the code generated by the recorder...

DAVEDEWEY

Thanks for the replies guys will try out the suggestion, the shape id is more that as i drop it on the page it reflects a piece of information from a drawing that i or my team recognises, it may be simply in the future its id will be referenced to change a colour

Yacine

Then you could call the shape data dialog by inserting the formula: DOCMD(1312) in the eventDrop cell of the Events section in the shapesheet.
Yacine

DAVEDEWEY

excellent thankyou,

I sort of see now that a lot of this is me not truly understanding where the commands are actually located, need to find some good books

DAVEDEWEY

Vojo been looking into your resolution for some reason no action occurs any ideas ?

vojo

see below

used a random number generator...but you can look at other algorithms

DAVEDEWEY

Thanku that makes a lot of sense,,

through all of this process I have generated a number of macros typical called something like this EBCB1ON the macro its self works well. I found through searching that you can run a macro from a command rather than copy and paste each time...

Many combinations but cant get it to work any ideas

RUNMACRO = (EBCB1OFF)

vojo

check help

running macro from a cell is a more complicated format than your post here.

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: 359 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1203KB.
Tokens: post-login.
Cache hits: 13: 0.00206s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]