A Patch Panel that can be 1U too

Microsoft Visio 2007 Professional and 2010 Professional and Premium includes the Network / Rack Diagram template, which opens the Rack-mounted equipment stencil. This stencil includes the Patch Panel master which can be stretched from 2U to 25U high. However, I have often required a 1U patch Panel, so I decided to look into the Microsoft shape to see if it could be modified to allow it to be reduced to 1U without looking ridiculous.


I opened up the ShapeSheet of the Patch Panel master and found that the formula in the Prop.UCount.Value cell is imposing 2 as a minimum value with the BOUND() function.

I changed the formula to =BOUND(2,0,FALSE,1,25), and was then able to change the UHeight to 1U, but the 24 ports remained visible:


I actually wanted the number of ports to be halved to 12, so I set about exploring the sub-shapes in the master. I found that Sheet.18 contains the port shapes, and that its height is fixed at 2 Us. All of its sub-shapes have a height formula referencing this height, so I decided to modify the PinY formula to =Sheet.5!Height*0.5*(IF(Sheet.5!Prop.UCount=1,2,1)) so that it would move the lower bank of ports up into the correct position if the Prop.UCount equals 1.


Then it was just necessary to go through each of the sub-shapes of Sheet.18 to modify the GeometryX.NoShow formula to =Sheet.5!Prop.UCount=1 for each Geometry section which is in the upper half of the shape.


At this point, I could see that I had to put this formula into 12 geometry sections of 4 shapes, which is 48 copy and pastes! Therefore, I decided to write some VBA code to do this instead. This has the advantage that you can run the code on existing documents that already have the Patch panel master in it. In fact, the Patch panel master must be in the local document stencil for this code to work.

 1: Public Sub UpdatePatchPanelMaster()
 2: Dim mst As Visio.Master
 3: Dim mstCopy As Visio.Master
 4: Dim shpPatchPanel As Visio.Shape
 5: Dim shpPortGroup As Visio.Shape
 6: Dim shpPortGraphics As Visio.Shape
 7: Dim i As Integer
 8: Dim iSect As Integer
 9: Dim dHeight As Double
 11:     For Each mst In Visio.ActiveDocument.Masters
 12:         If mst.Name = "Patch panel" Then
 13:             Set mstCopy = mst.Open
 14:             Set shpPatchPanel = mstCopy.Shapes(1)
 15:             For Each shpPortGroup In shpPatchPanel.Shapes
 16:                 If shpPortGroup.Cells("Height").FormulaU = _
 17:                         "Sheet.5!User.OneUHeight*2" Then
 18:                     shpPortGroup.Cells("PinY").FormulaU = _
 19:                         "=Sheet.5!Height*0.5*(IF(Sheet.5!Prop.UCount=1,2,1))"
 20:                     For Each shpPortGraphics In shpPortGroup.Shapes
 21:                         dHeight = shpPortGraphics.Cells("Height").ResultIU
 22:                         For i = 0 To shpPortGraphics.GeometryCount - 1
 23:                             iSect = Visio.visSectionFirstComponent + i
 24:                             If shpPortGraphics.CellsSRC(iSect, _
 25:                                     Visio.visRowComponent + 1, _
 26:                                     Visio.visY).ResultIU > dHeight * 0.5 Then
 27:                                 shpPortGraphics.CellsSRC(iSect, 0, _
 28:                                     Visio.visCompNoShow).Formula = _
 29:                                     "=Sheet.5!Prop.UCount=1"
 30:                             End If
 31:                         Next i
 32:                     Next shpPortGraphics
 33:                     Exit For
 34:                 End If
 35:             Next shpPortGroup
 36:             mstCopy.Close
 37:             mst.MatchByName = True
 38:             Exit For
 39:         End If
 40:     Next mst
 42: End Sub

And there you have it … the Patch panel can now be reduced to 1 U and it looks OK!


If you cannot be bothered to run the code, you can download the updated Patch panel and the code from here :  click here

Posted in Visio. 28 Comments »

28 Responses to “A Patch Panel that can be 1U too”

  1. Hernán Silva Olivares Says:

    davidjpp, great example, tanks you, from Chile.!!!

  2. Benny Says:


  3. Barny Says:

    Thanks for figuring this out. Special thanks for the “If you cannot be bothered” .vsd link : )

  4. Hasi Says:

    Thx a lot mate

  5. clark Says:

    Thanks a lot from taiwan

  6. John Mitchell Says:

    Thanks from George, South Africa!

  7. ugandran Says:

    we need data center and floor idf contaiment stencil to be download in our current visio2007

  8. Lee Says:

    I don’t know if it’s just me, but for some reason the file will only open with powerpoint, where I get an error. Visio won’t recognize the file to import. I can’t believe finding a 1U patch panel has held this thing up 4 hours. Please help.

  9. Adrian James Says:

    Thanks I copied it – works well

  10. Juliana Says:

    You are so kind in sharing! Thanks a lot from Sweden/Brazil

  11. MrSaphique Says:

    I get an error the PinY.
    Standard value is: (BeginY+EndY)/2 what do I need to fill in here?

    • davidjpp Says:

      When do you get this error?
      What language are you using?
      I enter the following for English:
      But you may need a comma as the decimal point?

  12. kathars1s Says:

    Download link is dead.

  13. kathars1s Says:

    How do we run this code? Where in Visio?

  14. damian Says:

    A good workaround and I like that you’ve changed to a VSD, however to make it easy, you can simply change the ShapeSheet data ‘User-defined Cells’, ‘User.OneUHeight’ to half of what it currently is, it will drop the height down.

    This is my fix for the situation at least, it still looks like it’s a double panel, but it looks pretty 🙂

  15. Kassa Says:

    Thank you very much this is really help me….. thank you again – From Sri Lanka.

  16. Антон Фатеев Says:

    Thanks from Tomsk, Russia.

  17. Loc Huynh Says:

    Nice .. it worked 🙂 Thanks much.

  18. alex Says:

    link is down, i need it please

  19. Norseman Says:

    Brilliant! Never ceases to amaze me how companies can miss the little things when marketing their products….don’t think it makes a difference to have the “Visual Guy” use tools branded with your logo? Think again! His Visuals sell your product to the check writers! Your sales reps can’t do that!

    Dude, thanks for this nifty tool! Couldn’t find a 24 port patch stencil anywhere! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


O365 and SharePoint

Simplify Tasks

Want to learn the simple way?

Paul Turley's SQL Server BI Blog

sharing my experiences with the Microsoft data platform, SQL Server BI, Data Modeling, SSAS Design, Power Pivot, Power BI, SSRS Advanced Design, Power BI, Dashboards & Visualization since 2009

John Goldsmith's visLog

be smart, be clear, be visual ...

Mo's blog

Personal views on Dynamics 365 for Operations and Technical Architecture.

Chris Webb's BI Blog

Microsoft Power BI, Analysis Services, MDX, DAX, M, Power Pivot and Power Query


Azure Solutions for Office 365, and more...

Rob Fahrni



Life with Visio and other Microsoft Toys!

Nilsandrey's Weblog

Just another WordPress.com weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Smart graphics for visual people

%d bloggers like this: