News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Recent posts

#1
Programming & Code / Visio Reports VRD files
Last post by JohnVisioMVP - November 10, 2024, 10:57:07 PM
Visio has an XML based reporting system. If you do a recursive dir of the .VRD on your system, you will get all the Report Definition files (.VRD) on your system. A number of the files will have a NameSpace like .
<VisioReportDefinition xmlns="urn:schemas-microsoft-com:office:visio:reportdefinition" ...>
Does anyone know what is in that NameSpace so I can examine the content?

I have a large collection of the VRDs and I have extracted a lot of the keywords, but I would like to explore the NameSpace to see what else the NameSpace containd.
#2
User-submitted Stuff / Re: Shape Creation: with conne...
Last post by wapperdude - November 09, 2024, 10:28:03 PM
*** Major Alert ***
This is a major update to the code.
1) Dbl click the shape to easily access the Shape Data
2) Separate macro to augment naming the pins.  Main macro asks to name pins (calling this macro), or this macro may be run separately on selected shape to add or rename after shape creation.  Note, a blank entry will delete the name.
3) Main macro now asks for pin spacing and number of pins per side.  No longer hard coded.

Once a shape is created, it is possible to change pin spacing via Shape Data.  In doing so, a larger value will increase shape size.  Smaller value does not automatically reduce size.  That may be done thru normal, manual resize methods.  Action, right click menu still allows options to hide pin numbers and pin labels.

See attached file.
#3
Programming & Code / Re: Shape within a shape
Last post by wapperdude - November 09, 2024, 07:28:58 PM
Thomas Winkel's recent reply stirred some thought.  With regards to OP possible thoughts, this topic may be closed, but it doesn't seem to be fully resolved.  Review of this post, offered up another option.  That is, each page represents a floor.  On each floor, there may be many rooms.  Each room will have a variety of shapes, and each of those shapes must identify to which room it belongs.  If might be possible to leverage CONTAINERs and Container properties to accommodate this identification.  There may still need be some additional coding, but this may be a useful stepping stone as it were. 

For example, if the SPACE shapes are used to define the rooms, their shapesheet may be edited to make it behave as a container.  This creates ownership and some useful properties.
#4
Programming & Code / Re: Shape within a shape
Last post by Thomas Winkel - November 09, 2024, 11:15:24 AM
Sorry, I missed this post. If the problem persists, provide an example that I can reproduce.
#5
Programming & Code / Re: Code to call a macro when ...
Last post by Yacine - November 09, 2024, 07:16:49 AM
You're correct in observing that the BeforeSelectionDelete event triggers before the selected shapes are deleted. This can make it challenging if you're trying to process or count shapes, as the deleted shapes are technically still available at that point.

The main purpose of the BeforeSelectionDelete event is to give you an opportunity to intervene before the actual deletion happens—whether that means modifying, counting, or even canceling the deletion. In this particular case, since you don't want to prevent the deletion but rather just update your counters accurately, a small tweak is needed.

Here's a clearer breakdown of the solution:

Delete the Shapes First: To get the correct count, you need to ensure the shapes are actually removed before calling your counter macro.
Update the Count Afterwards: Once the shapes are deleted, you can then accurately update the count.
Here's how you can modify your code:

Private Sub Document_BeforeSelectionDelete(ByVal Selection As IVSelection)
    ' Delete the selected shapes first
    Selection.Delete
   
    ' Now update the count display after deletion
    Call Display10pipecountInTextBox
    Call Display20pipecountInTextBox
End Sub
#6
Programming & Code / Re: Code to call a macro when ...
Last post by wapperdude - November 09, 2024, 03:46:08 AM
Officially, there is no event for after deleting.  Don't recall seeing a workaround either.
#7
Programming & Code / Code to call a macro when a sh...
Last post by droper1 - November 08, 2024, 05:37:21 PM
I'm trying to get VBA to call a macro when a shape or selection of shapes is deleted from a page. The macro in question is providing a real time count of the different shapes on the page so we can see at a glance how much of a piece of equipment is needed. I've been able to get this to work when ADDING shapes to a page, but can't seem to figure out how to make it work when deleting. Using the below code, the count will always be 1 off when deleting because the macro is called BEFORE the selection is deleted. I don't see any other functions on the list that would trigger when a shape is deleted, though. Any insight would be appreciated. My coding ability is limited, and ChatGPT can only get me so far...

Private Sub Document_ShapeAdded(ByVal Shape As IVShape)
    ' Update the count display when a shape is added
    Call Display10pipecountInTextBox
    Call Display20pipecountInTextBox
End Sub

Private Sub Document_BeforeSelectionDelete(ByVal Selection As IVSelection)
' Update the count display when a shape is added
    Call Display10pipecountInTextBox
    Call Display20pipecountInTextBox
End Sub
#8
Programming & Code / Re: VisioExcelSync
Last post by Thomas Winkel - November 07, 2024, 08:43:25 PM
Hi Yacine,

don't worry, the effort was not too much because I can copy from my solutions.
If you need help to get startet with these Ribbon things we can also discuss this in a teams meeting.
You could also think about an Excel Addin (xlam) to deploy your solution.
It's a bit like storing code in a Visio document vs stencil.

I also like using AI for my projects. Mainly for generating demo code, but also for consulting.
This helps me do things I have no idea about ;D
Really powerful!

👋
#9
Shapes & Templates / Re: Automate adding connection...
Last post by wapperdude - November 07, 2024, 04:33:02 PM
This is an interesting question...whether or not it's sincere.

Visio doesnot come with such a built-in feature.  AFAIK, there is no add-in that does this.  The solution requires custom code.  Thus, there needs to be more info defining "automated" requirements.  Note, code solutions are not universally accepted by many companies for security reasons.

Automating connection point placement for existing, arbitrary shapes would be extremely difficult for anything other than rectangular shapes, and possibly circular.  Specific location might mean literal coordinates or percentage coordinates (as in distance along a path).  Star-like shapes would be extremely troublesome.  Whichever meaning is meant, there would need to be verification that, as a rule, the intended placement location is on the actual shape outline. 

There is, this posted topic, that presents a potential automated solution.  But this builds a rectangular shape to accommodate the specified connection points.   "Build shape with Conn Pts"  .  This is a concept presentation.  As presently configured, before running the macro, you must edit it to set number of pins, their spacing, and distribution around the shape edges.
 
#10
General Visio / Re: Visio 2021 w/ office 2024
Last post by Nikolay - November 07, 2024, 04:19:32 PM
You may be on subscription license that defines what version you get when you install office. It can also be controlled by your company admin. In the new world, just downloading a launcher file that ends with 2024 brings nothing. You don't even need to download anything now, you can just switch the version from within the product itself:

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: 130 (show)
Files included: 26 - 1002KB. (show)
Memory used: 885KB.
Tokens: post-login.
Cache hits: 9: 0.00167s for 22,983 bytes (show)
Cache misses: 3: (show)
Queries used: 11.

[Show Queries]