Sunday, 14 June 2015

Marcos in Visio

A Free Document Productivity Tool For Visio

This post outlines how to access and use the upcoming Visio tools to be posted shortly.

General Concept

The code for the tools is available from a template that you can download from here.  The idea is to create your own template and copy the published code into into it, then assign each tool to a shortcut key so that it can be quickly accessed.

I have chosen this method to distribute the code so that it can be inspected to show that it is safe to use, and so that it can be used as a learning aid. This is a bare bones approach that is consistent with the approach used for the Word tools and give the user the best control of the process.

Keeping the code in the template means that there is no code in each of the documents created. Other users of the document are therefore not impacted by the tools. 

The downside is that you will probably need several copies of the code in each of the templates that you use, and need to update each when new code is issued.

Copying the code is quite simple and only takes a minute or two.


Creating a New Template

To create a template, take a diagram or start with a blank diagram and use the save as dialogue to create save the document as a "Visio Macro-Enabled Template" (*.vstm) 

I recommend taking the time to get this template just right for the diagram you are working on.  For example, get the default connector correct so you don't have to change format each time, get the view and layout correct and open the usual stencils so these are always at hand for any new diagrams.


Download the Code

Down load the tools template form here. Then open the downloaded template.


Adding Code to the Template

Ensure that the Developer tab is visible.  See the entry at the bottom of the post to do this.




Now open VBA and create a new module. 



Right click on Visio Objects and select Insert Module






You can view the Properties window and change the name of the module.



Now open the downloaded template and use VBA to view he code in dpDocProdTools.

Select all of the code (Ctl+a) and copy into the similar code panel in your new template.

The code is ready to go.







 Now select the Macro security option of the developer Tab.  Set the security to the value shown.

When the template is opened, you will be asked to confirm that you want to use the code


Invoking the Tools

These Visio tools are invoked from shortcut keys. This makes them quick to use.





To allocate code (a macro) to a short cut key, select Macros, select the macro, take the Options button and enter the key to assign to it.



Handling Documents Prepared by Others

If you want to use the tools with a Visio document created by others, you can use the document to create a template, then add the code (see above).  The template can then be used to create a new instance of the document for further editing. 

Alternatively, you can add the code to the document itself. 


Enabling the Developer tab

To enable the developer tab:


Select the drop down link at the top of the window.








The select more commands.





Now tick the developer tab box on the right



















No comments:

Post a Comment

Please add comments, encouragement and suggestions. You can be anonymous if you want.