Auto generate regional trail map

Started by trailz, May 11, 2018, 12:39:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

trailz

Hi,
I'm not an experienced coder. I'm self teaching myself through reference page examples and other threads on this forum. What I want to accomplish seems simple, but I'm having trouble accomplishing my goal. My goal is to take an excel spreadsheet with a list of trails and have visio map out those trails by having a shape represent a junction on the trail and have the trail names along the connectors between the junctions. Changes made to the excel document will be updated on the diagram(new trails, changes to existing trails, etc).

My excel spreadsheet is laid out with the first column having the trail name and the subsequent columns naming the beginning, middle, and end points. Some trails may have 3 points along the way and some may have as many as 8.

What I've been able to accomplish so far in VBA is to get the excel data loaded into visio as a data recordset and use autoconnect to connect shapes using static information.

I have no idea how to loop through every row then loop through the columns matching the junction names with the junction shapes then autoconnect and label those connections. Some trails share overlapping sections too so there would be multiple labels.

bhughes89

Can you upload the spreadsheet and Visio files that you already have, so we can take a look at the data you have and how it's been brought in as a data recordset?
And perhaps a pic of what you'd like your end result to be?

I haven't worked with data recordsets before but I'm sure we could help you find a way to loop thru it to find matching junction names :)

trailz

Thanks for your reply. I've attached a spreadsheet and a visio document. I manually created in the visio document what I would like to be automatically generated based on the spreadsheet.

Croc

You have chosen not the most successful format of the source data.
I suggest you move on to describing the individual links. To associate a single row with a single connector.
Your data in the new format will look like in the table below.
In this case, the scheme can be built in two passes.
1. Select all unique nodes from the first column and place them on the diagram.
2. In the second pass connect pairs of nodes. (One line - one connector).
Since your data does not contain coordinates, you will have to move the nodes manually later.
This picture received at about this algorithm.