Sunday, June 3, 2012

Merging Visio Drawings

Microsoft Visio drawings can have multiple pages/tabs.  People sometimes want to move pages from one drawing to another.  You cannot do this, as explained by this post:

However, it is possible with VBA programming to merge drawing together.  You merely make sure the drawings you merge have the pages you want to combine.  Here is a link that contains VBA code that does the drawing merge.

If you read the code at the link above you will see the TryMergeDocs subroutine uses a hard-coded array of Visio files.  It does not have to be done this way.  Here is an example of a GUI to merge a number of Visio drawings without hard-coding the names:


You enter drawing names into the textbox, click the "Add Drawing" button to add the drawing name to an array of names, then the "Merge Drawings" button will invoke the TryMergeDocs subroutine using the array you just built.  You have to keep track of how many elements are in the array and replace "UBound(FileNames)" with the index of the last useful array element.

Robert

No comments:

Post a Comment

Comments require my approval before they appear. Be patient. It will take a day or two for your comment to appear.