New tool – Visio Import/Export VBA

Hi all,

Have recently have created an extension to import/export VBA code from a Visio drawing or stencil. You can find this useful if you want to track VBA source code changes in your Visio files, like compare current version of the code with the past version. Could make sense to use together with some version control like TFS, Subversion, or GIT.

Extension page:
VBA Import/Export for Visio

Continue reading“New tool – Visio Import/Export VBA”

Visio project templates updated (Visio 2016, VS 2015 support)

Visio project templates updated to version 1.0.7:

– added support for Visual Studio 2015
– added support for Visio 2016
– Simplified source code (removed extra files, so that project structure is more like vanilla VS).
Unified project wizard. Now there is one wizard to rule it all. It allows you to add (bside the add-in itself) other Visio files/templates in the wizard itself, add name/description, etc. Addin type selection, Visio files selection, setup – from one wizard.
– License support in installer.
– Support for the built-in VS ribbon designer (optional)
– Support for both x86 and x64 in one installer in one MSI (one DLL compiled to “AnyCPU”)
– Support per user/per machine install in one MSI
– Support for project auto-harvesting. Means, DLL version is auto-harvested, COM registration auto-harvested (for COM addin type).

Continue reading“Visio project templates updated (Visio 2016, VS 2015 support)”

Rubberduck – refactoring in VBA

Hi all, recently came across an interesting Rubberduck project. Did you think that VBA is dead and buried? It looks like it’s not going down that easily!

Rubberduck is a COM Add-In for the VBA IDE that makes VBA development even more enjoyable, by extending the Visual Basic Editor (VBE) with menus, toolbars and toolwindows that enable things we didn’t even think were possible when we first started this project.

If you’re learning VBA, Rubberduck can help you avoid a few common beginner mistakes, and can probably show you a trick or two – even if you’re only ever writing macros. If you’re a more advanced programmer, you will appreciate the richness of Rubberduck’s feature set.

Continue reading“Rubberduck – refactoring in VBA”

Moving control point along path in Visio

Hello all, Here is a technique you can use to make control point stick to a connector path. I\’ve learned it recently from these two topics (one, two). I found it interesting:

test

To achieve this sort behavior (although not necessarily with hearts, but just plain text) you can use some Visio ShapeSheet functions, which might be not of everyday use: POINTALONGPATH, allows you to figure out current position on the path from the start, NEARESTPOINTONPATH, allows you to find a nearest point to the path from a given point, ANGLEALONGPATH, allows you to find the current angle See more about these here

To keep the control points on path, a technique is used based on SETATREF(SETATREFEXPR()) to transfer user value of control point to user cells which are then transferred to the Scratch section to split X/Y and then back to the control point:
2-20-2015

See the attached Visio file for the full sample, and more information about SETATREF/SETATREFEXPR here. And, yea, happy Valentine\’s day whoever celebrated it 🙂

point-along-path.vsd_.zip (13.6 KiB)

Update to Visio Addin project templates

Visio project templates updated to version 1.0.2:

– Now Visual Basic projects are also supported
– now the platform of the installed Visio is selected by default, and Visio is selected as executable to debug by default
– Added default UI to the installer
– Fixed issue with some configurations (error on project creation if some specific combination of checkboxes is selected)

More information here

Project templates: Visio Panel Addin

Hello all,

Have recently published a bunch of templates to create Visio Add-ins in Visual Studio. Templates for creating Visio COM addnins & VSTO addins. The template includes:

– Installer project
– User interface to start with
– A TaskPane (not really a “TaskPane”, but a docking panel), and a toggle button to control it
– Custom images for the buttons.
– State (enabled/disabled) for the buttons.
– Optional support for legacy Visio version (2003/2007; command bar with buttons)

More information

Configuring SharePoint library to store Visio documents

This post explains how one can set up a standard SharePoint document library to store Visio drawings, with option to create new drawings from a custom template (i.e. to allow your custom templates under “New” button in SharePoint). I’ve spent some time figuring this out for myself.. 🙂 Can be useful when:

1) You have a SharePoint (or Office 365 with SharePoint site, doesn’t really matter). Note that you don’t necessarily need Visio Process Repository (and thus SharePoint Enterprise). You can use normal document library as well (it will also work, just not all functionality will be available).

2) You want to provide some Visio template to your users (or for yourself) so it is possible for them to create new diagrams using that template directly from the site. For example, if you work in some organization, and want your users to use a specific template to draw diagrams.

In this post, I have added a Visio "Template X" as an example (containing "Stencil X"). Note that template and stencil should be stored in the same folder in SharePoint so that Visio can find the stencil when it creates new diagram out of the template.

Here is a step-by-step video:

http://www.youtube.com/watch?v=5a93U6DvEc4

To get things running the following steps are to be done:

  1. Create a template and a stencil.
  2. Upload template and stencil to some document library on the site (e.g. SiteAssets)
  3. Add new document content type on the site for our template
  4. Allow this content type for the document library where you want to store you Visio drawings.

    1. Creating a Visio template and stencils.

    I think this part is pretty much covered in Visio documentation. Note that you can just use existing Visio template/stencil, in this article I create new ones for demo purposes basically, to show how to make it all from scratch.

    2. Uploading to SharePoint site.

    Uploading should not be a problem, you just select a target library and save stencil and template to that library. I opted to use “SiteAssets” as it exists by default and contains files related to the site. Note that in SharePoint library settings you have an option to “edit template” – this was designed to work with Word/Excel and may not work as expected for Visio, if you have a custom stencil. So if you have both custom template and stencil, I would recommend to put them next to each other in one library.

image

3. Adding new content type

3.1 Go to Site Settings => Site Content Types => Create
3.2. Enter data form the new content type:

  • Name => "Template X",
  • Parent content type => "Document content type / Document",
  • Group => Anything, you can create a new group e.g. "Visio Templates"

image

4. Enabling this content type in the document library:

4.1 Go to Library => Library Settings
4.2 Ensure that “Content type management” is enabled under “Advanced” (option should be checked).
4.3 Click Content types => Add from existing site content types
4.4 Select “Template X” created at the previous step, click “Add”, “OK”. You should get this content type listed now under “Content types”.
4.5 Click the “Template X” now (we will assign template for it now).
4.6 Click “Advanced settings”, and the in the field “Document template” enter the path to the template in the “SiteAssets” document library, like “/SiteAssets/TemplateX.vst”, Click OK.
4.7 Now new option should appear under “New” menu, listing our new template.

That’s it. Now the template should be under "New" menu, and everybody who has access to the library should be able to create new diagram using that template (and stencil).