News:

Happy New Year!

Main Menu

Recent posts

#91
General Visio / Re: Phase position in a cross ...
Last post by Oonizuk - March 31, 2025, 08:10:14 PM
I found a solution to my issue here without the excel database.
#92
User-submitted Stuff / Re: Multi-line patterns
Last post by Ricky78 - March 31, 2025, 07:04:25 PM
@Yacine, in the mutli-line stencil you kindly created I noticed that the number of parallel lines of the shapes has an off-set of +1. When I enter a value in the shape data field called "NumLane" the displayed amount is +1. Is there a way to fix this? I'm not familar yet with the ShapeSheet but I assume that would be the place to make the necessary changes?
#93
Programming & Code / Re: Code Signing
Last post by Visio Guy - March 31, 2025, 02:06:57 PM
Does any of this get easier if we use an installer like WiX instead of ClickOnce? Or is ClickOnce just another installer, and there's nothing special about it?
#94
General Visio / Re: Delete all hyperlinks in o...
Last post by Yacine - March 28, 2025, 12:58:57 PM
Sub DeleteAllHyperlinks()
    Dim shp As Visio.Shape
    Dim i As Integer
   
    ' Loop through all top-level shapes on the active page
    For Each shp In ActivePage.Shapes
        ' Delete hyperlinks from last to first to avoid index shifting
        For i = shp.Hyperlinks.Count To 1 Step -1
            shp.Hyperlinks(i).Delete
        Next i
    Next shp
End Sub

Explanation:

Key is to know your object model.

First you record a macro where you do what your future macro shall do.

Sub Macro1()

    'Enable diagram services
    Dim DiagramServices As Integer
    DiagramServices = ActiveDocument.DiagramServicesEnabled
    ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Insert Hyperlinks")
    Application.ActiveWindow.Page.Shapes.ItemFromID(1).Hyperlinks.ItemU("Row_1").Delete
    Application.EndUndoScope UndoScopeID1, True

    'Restore diagram services
    ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub

A lot of useless stuff in it. Try to identify the key command:

Application.ActiveWindow.Page.Shapes.ItemFromID(1).Hyperlinks.ItemU("Row_1").Delete

 Application.ActiveWindow.Page.Shapes.ItemFromID(1) is the shape.

 .Hyperlinks.ItemU("Row_1").Delete is the actual command. But it refers to a specific row. So you need to figure out how to generalize it and later iterate over all the rows.

Luckily you got a hint in the form of "shape.Hyperlinks", that's a thing you can look for in the manuals: https://learn.microsoft.com/en-us/office/vba/api/visio.shape.hyperlinks

And you read that hyperlinks is a collection. So why not iterate over it with a for loop. in your editor try hyperlinks(i) or hyperlinks.item(i). Use the debug.print function for the inspection. Hey it worked.

Pack your new code in a loop that covers all the shapes. Done.
#95
General Visio / Delete all hyperlinks in one g...
Last post by Ricky78 - March 28, 2025, 12:11:01 AM
Hi, I have many shapes with hyperlinks on a page and would like to delete them all in one go rather than one-by-one. Does anyone have a utility/macro or similar for this available? Thx
#96
General Visio / Re: Break line pair (Roadway b...
Last post by wapperdude - March 27, 2025, 05:20:12 PM
 :D  :D  :D ...Ah!  That memory reference...yes, but taken out of context though; when it was made, an allusion to...Nevada, Area 51, sudden memory loss, bright lights, shadowy figures... aliens, deliberate memory wipe conspiracy thing.  Granted, at least some elements of truth.   :o

Anyway, your post triggered that memory.



#97
General Visio / Re: Break line pair (Roadway b...
Last post by Yacine - March 27, 2025, 04:26:15 PM
... so you were complaining about bad memory? 
And yes, now I recall having seen that too. Basically the same, just with longer stubs.
#98
General Visio / Re: Break line pair (Roadway b...
Last post by wapperdude - March 27, 2025, 02:39:34 PM
Actually, your idea is quite similar to something John Gold smith did s few years ago, see https://visualsignals.typepad.co.uk/vislog/2015/04/building-a-labelled-dynamic-connector-in-visio.html.

The idea was to avoid schematic clutter by only show labelled Stubbs at begin / end of each connector.  The middle could be shown or hidden.  The problem is you lose the visual continuity clue.  But, taking from a recent post, perhaps when a connector is selected, its full shape could be visible, eh?

Edit:  27 Mar 2025, The "recent" post is this one:  https://visguy.com/vgforum/index.php?topic=10683.msg50521;topicseen#msg50521
#99
General Visio / Re: Break line pair (Roadway b...
Last post by Yacine - March 27, 2025, 10:47:22 AM
I wonder if custom connectors wouldn't be an option.
A 1D shape as group. In it 3 connectors - or only 2 for the ends.
The ends visible and can be formatted as needed and routed manually.
In between either an invisible connector or nothing.
The containing group could still be interpreted as connector and be inspected by code (to report on connections)
Controls points of that group could define the extends of the underlying connectors.

Just some silly thoughts...
#100
General Visio / Re: Break line pair (Roadway b...
Last post by wapperdude - March 27, 2025, 01:15:32 AM
Update that allows (clunky???) addition of connection points.  Hey. It works!   ;D

Basically, used two shapes and grouped them.  This is the orange filled shape as shown in the attached file.  The parent, top shape has all of the controls and mode selection as before.  However, each subshape may be individually selected, and that allows addition of connection points.  Not the nicest approach, but it does work.  Now, whatever method is used to resize, the connection points will track.
Browser ID: smf (possibly_robot)
Templates: 2: index (default), Recent (default).
Sub templates: 6: init, html_above, body_above, recent, body_below, html_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 2: index.css, responsive.css.
Hooks called: 133 (show)
Files included: 26 - 1002KB. (show)
Memory used: 888KB.
Tokens: post-login.
Cache hits: 10: 0.00139s for 22,847 bytes (show)
Cache misses: 4: (show)
Queries used: 11.

[Show Queries]