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

Data Sources and Network Diagrams

Started by JustAnITGuy, July 25, 2022, 08:02:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JustAnITGuy

I have a need/desire to take network diagrams and import data (excel) and link it to the shapedata.  Now I have already done this, however I would like to make the Visio a template.  By that I mean I need to have multiple copies of the visio and excel workbooks as I will need multiple diagrams using different data.  Currently, I can only copy both worksheet and visio and relink everything which defeats the purpose of the time savings that a reusable template would offer.

If I'm not clear I can restate.  Any ideas or suggestions?

Surrogate

Quote from: JustAnITGuy on July 25, 2022, 08:02:16 PMNow I have already done this, however I would like to make the Visio a template.
Hi there !
What you mean as Template ?
You have a lot of same diagrams which have only different text properties like hostnames, IP etc ?

Yacine

#2
Hi,
very good question indeed.


Since you're an IT guy, it should not be a big problem for you writing a couple of VBA code lines.


Your starting point would be the DataRecordsets and DataRecordset objects.
( https://docs.microsoft.com/en-us/office/vba/api/visio.datarecordset and https://docs.microsoft.com/en-us/office/vba/api/visio.datarecordsets )


The easiest would have been to edit directly the document property of the datarecordset object, but alas, it is read only.
So you'll probably need to delete the original and create a new one, re-establish the connections ,... etc.


(A very bold idea: why not target directly the document name of the excel workbook in the XML file of the Visio drawing? Not sure if it could work. but then you wouldn't need to rewire everything)


As link for the new excel file, you could either use the name of your visio file and probably require the file to be in the same folder,
or you have your macro ask for the location of the new excel file.


Also bold, packing the visio and the excel file in a zip and hoping they could communicate by means of relative paths alone. Not sure if that could work.


By the way, using a proper identifying system (unique IDs) you can wire shapes automatically to a dataset.


So far for my 2 cents,
Looking forward to what you come up with.



HTH,
Y.
Yacine

Yacine

... and I forgot the most obvious one.

Don't use multiple files. Make one that updates dynamically.
The results being volatile, would then be exported by your solution in the appropriate formats (visio, pdf, html, the simplest the better). Naming as per your needs - time stamps, scenario names, etc.
Yacine

Surrogate

Quote from: Yacine on July 26, 2022, 10:27:47 AMBy the way, using a proper identifying system (unique IDs) you can wire shapes automatically to a dataset.
I totally agree !

JustAnITGuy

Quote from: Surrogate on July 26, 2022, 04:28:48 AM
Hi there !
What you mean as Template ?
You have a lot of same diagrams which have only different text properties like hostnames, IP etc ?

Greetings, by template,  I have multiple networks that have the same structures/shapes/ect.  I just need to feed the Visio a different source for each. I'll need multiple copies of the diagram and workbook w/o having to re-link all the relationships.

Yacine


By pure luck I stumbled upon the David Parker's post below. It should fully answer your question.
https://bvisual.net/2015/03/13/updating-the-file-path-of-data-linked-excel-tables-in-visio/
Yacine

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 268 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1119KB.
Tokens: post-login.
Cache hits: 14: 0.00267s for 26,722 bytes (show)
Cache misses: 4: (show)
Queries used: 18.

[Show Queries]