Triggering code in stencil only the first time, when shape is dropped

Started by Visisthebest, October 04, 2021, 09:05:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Visisthebest

I am still very much a shapesheet newbie but loving the DEPENDSON() function a lot!

Now also using it to get VBA code (in the stencil) to run the first time a shape is dropped on the page.

I added a user cell with this:
=CALLTHIS("ThisDocument.DT","DTStencil")+DEPENDSON(PinX)

Works like a charm, and I can of course add another user field where I set a flag when the code is run the first time (on drop on the page, when PinX is set for the first time), so the code checks the flag before running the full initializing code again when it is moved (I am using DEPENDSON on PinX after all).

No doubt there is also a way to do this on the shapesheet, so that after the first drop a shapesheet function sets a flag then the next time, when the shape is moved, CALLTHIS is not run again.

This is however beyond my knowledge of making more complex shapesheet formulas properly so any ideas how to do this much appreciated!

Visio 2021 Professional

Surrogate

IMHO best way use EventDrop cell for single trigger

Something like this


EventDropCALLTHIS("ThisDocument.DT","DTStencil")

Visisthebest

Yes I should've used that one thank you Surrogate, didn't know about this possibility!
Visio 2021 Professional