Face-Face, Corner-Corner Alignment (Abut Shapes)

Started by wapperdude, August 16, 2019, 04:13:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

This is an updated version of old post.

This now accommodates offsets from center-middle of the LocPin's.  Because of this, there are certain cases when either/both Flip Horizontal, Flip Vertical will cause formula errors and invalid results.
Visio 2019 Pro

wapperdude

Visio 2019 Pro

Visio Guy

I love this thing. I've developed similar add-ins that I've called "Abut" because this shoves shapes together. This, by the way, is really, really, really, really useful!

Anyway, I've just modified wapperdude's offering in the following way:


  • Moved code into a macro-enabled stencil, entitled VBA Alignment Tools.vssm
  • Launch the form as "modeless", so it stays open all the time. You may have to click twice when going from the form back into a Visio drawing, but you get used to that quickly.
  • Created a shape that you can double-click to launch the form. Just drag it onto a page and double-click it, rather than figure out how to launch macros from the ribbon (View > Macros > Macros...)
  • The stencil can be placed in the folder: %userprofile%\Documents\My Shapes
  • You can also access the My Shapes folder via Shapes > More Shapes > My Shapes > Organize My Shapes
  • As a stencil, the code can now be accessed by any document. Just Go to Shapes > More Shapes > My Shapes and pick the stencil.

By putting code in a stencil, you increase flexibility by allowing easy access to the code from any drawing, and you decrease "code proliferation", where many documents contain variants of the code. Also, documents no longer contain VBA code, so sending them to people who don't want to run code or aren't allowed to run code can still use the documents. The code-stencil functions as an add-in that users can choose to load or not load.

Cheers,

Chris
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

Here is a screenshot that shows how to access a stencil saved in My Shapes. It also shows the "macro-launching button shape" that you can drag onto any drawing page, then double-click to launch the Adjacent Align form.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

wapperdude

THANK YOU!!!

I was drawing a blank on how to make this easily accessible.  For some reason, adding code to a stencil is like a blind spot for me.  The stencil is super. 
Visio 2019 Pro

MatLcq

This is amazing! I was looking for a way to share tools using VBA without having code in the document itself and this is exactly it  :D
Any trick needed to make it work or is it as straightforward as you describe it?
How did you make the form "modeless"? When looking at the form properties, showModal = True, but it should be false right?
Thank you a lot for sharing this.
BTW, thank wapperdude for this excellent tool!! I'm using it all the time.

MatLcq

Quote from: Visio Guy on August 21, 2019, 04:33:20 PM
[...] By putting code in a stencil, you increase flexibility by allowing easy access to the code from any drawing, and you decrease "code proliferation", where many documents contain variants of the code. Also, documents no longer contain VBA code, so sending them to people who don't want to run code or aren't allowed to run code can still use the documents. The code-stencil functions as an add-in that users can choose to load or not load [...]

In the master shape of your stencil, there's a User.PageRef with formula set to =ThePage!Actions.UpdateConnectionCount+ThePage!Actions.UpdateConnectionCount
That function doesn't exists in the MCallThis VBA module. Is this just something left from an other use or is is important?

wapperdude

All things associated with the stencil were provided by Visio Guy.  I had verified that things worked fine, but have not reviewed all of the new coding.  It sounds like the User.PageRef might have been o holdover, but, as I had no error mssg, no reason to delve into the code/shapesheet. 

Visio 2019 Pro

dcasciato

Being relative new to Visio I am not sure what this is code does.

May I suggest someone create a YouTube demonstration of how to add to Visio and the use of the ?Macro?

Thanks Dan