Author Topic: Data Sources and Network Diagrams  (Read 3116 times)

0 Members and 1 Guest are viewing this topic.

JustAnITGuy

  • Newbie
  • *
  • Posts: 2
Data Sources and Network Diagrams
« on: July 25, 2022, 03:02:16 PM »
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

  • Hero Member
  • *****
  • Posts: 1782
    • ShapeSheet™ Knowledge Base
Re: Data Sources and Network Diagrams
« Reply #1 on: July 25, 2022, 11:28:48 PM »
Now 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

  • Hero Member
  • *****
  • Posts: 3163
Re: Data Sources and Network Diagrams
« Reply #2 on: July 26, 2022, 05:27:47 AM »
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.
« Last Edit: July 26, 2022, 06:13:02 AM by Yacine »
Yacine

Yacine

  • Hero Member
  • *****
  • Posts: 3163
Re: Data Sources and Network Diagrams
« Reply #3 on: July 26, 2022, 05:34:13 AM »
... 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

  • Hero Member
  • *****
  • Posts: 1782
    • ShapeSheet™ Knowledge Base
Re: Data Sources and Network Diagrams
« Reply #4 on: July 26, 2022, 06:00:56 AM »
By the way, using a proper identifying system (unique IDs) you can wire shapes automatically to a dataset.
I totally agree !

JustAnITGuy

  • Newbie
  • *
  • Posts: 2
Re: Data Sources and Network Diagrams
« Reply #5 on: July 26, 2022, 08:11:22 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

  • Hero Member
  • *****
  • Posts: 3163
Re: Data Sources and Network Diagrams
« Reply #6 on: July 31, 2022, 06:10:17 AM »

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