Author Topic: Face-Face, Corner-Corner Alignment (Abut Shapes)  (Read 970 times)

0 Members and 1 Guest are viewing this topic.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3682
  • Ideas Visio-lized into solutions
Face-Face, Corner-Corner Alignment (Abut Shapes)
« on: August 16, 2019, 11:13:11 AM »
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.
« Last Edit: August 21, 2019, 11:33:46 AM by Visio Guy »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3682
  • Ideas Visio-lized into solutions
« Last Edit: August 21, 2019, 11:33:54 AM by Visio Guy »
Visio 2019 Pro

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1669
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #2 on: August 21, 2019, 11:33:20 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1669
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #3 on: August 21, 2019, 11:38:26 AM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3682
  • Ideas Visio-lized into solutions
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #4 on: August 21, 2019, 01:05:01 PM »
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

  • Jr. Member
  • **
  • Posts: 10
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #5 on: February 13, 2020, 03:40:49 AM »
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

  • Jr. Member
  • **
  • Posts: 10
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #6 on: February 17, 2020, 09:46:51 AM »
[...] 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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3682
  • Ideas Visio-lized into solutions
Re: Face-Face, Corner-Corner Alignment (Abut Shapes)
« Reply #7 on: February 17, 2020, 01:56:25 PM »
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