Drawing land map with Visio and programmatically color coding shapes

Started by rmk9785e, July 23, 2019, 07:25:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rmk9785e

First time to this forum. I've used Visio during my career and even after many years of use, I've only scratched the surface of its capabilities. I've taken on an interesting challenge on my own to learn even more.
I am wanting to draw a land map divided into rectangles (measuring an acre) that are 198 feet x 220 feet each in 5x5 rows. Some of these rectangles will be split into eight equal parts (the unit is called Kanals). Each rectangle will be assigned a number such as 521/1/1, 521/1/2, ....521/1/25.
I have data in a spreadsheet that similar numbers (text strings) for each rectangle and lists its owner. I wish to match these numbers/text strings between the spreadsheet cells & Visio rectangles and assign them a color for each owner.
Any ideas for developing such a diagram are appreciated.

wapperdude

There are a variety of ways to do this.  One approach would be to put all info in Excel, then use VBA to loop thru Excel, place the shapes, and color them.  If desired, VBA could group each 5x5 array of 8 Kanals.

The Excel file could be organized into 25 rows, each row being an acre unit.  The columns would contain the Kanals, ID info, owner, and desired RGB coloring.  Yeah, that's a lot of columns, but, there's a lot of info.

The VBA could go thru each column, 1 row at a time, look at the ID, translate to X,Y location,color the shape, add to a selections collection, and when row is completed, group the selections.  Deselect, and repeat.

That ought to get you going.
Visio 2019 Pro

rmk9785e

Thank you for this informative guidance. I can organize all that data in Excel and am somewhat familiar with VB script but would need to learn to populate that in Visio with coordinates. Where can I find some examples for VB code to integrate Excel data into Visio?
My desired drawing (example attached) will be a 22x20 matrix of squares, each with a number in the upper left corner of each and a color fill based upon a value in the excel row (example attached).

wapperdude

Visio 2019 Pro