Create Perfect Previews for your Templates

We have all seen the high quality previews that are shown from the Getting Started task pane.


If you select any of the templates that are installed with the product they all display a high resolution preview.

As a Visio solution developer you create your own setup (MSI) and publish your template(s) using the Visio Solution Publishing tool from the Visio 2007 SDK.  This allows you to add your template(s) to the Template Categories list in the Getting Started task pane.

After you create your setup and install it you notice that your preview quality is not what you had expected.


What you expect is...


You might have even set the PreviewQuality cell on the DocumentSheet to Detailed


(0 = Draft, 1 = Detailed)

but you still get the low resolution preview image, what gives?

Increase the Quality limits

Visio generates a metafile for your preview when you save your document but it will only use the metafile for the preview if it is below a predefined size.  If the metafile size exceeds this size then Visio will create a lower resolution bitmap and use that as the preview instead.  To overcome this you can edit the registry settings that control this logic.

First, make sure you tell Visio to add all of its settings to the registry.  By default Visio does not write all of the possible registry settings to the registry.  You have to select this option on the Advanced tab of the Tools > Options dialog (Put all settings in Windows registry).


After you have selected this option, shut down Visio.  You can now examine the registry using regedit.exe.  Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Visio\Application and within this key you should see the following settings:

ThumbnailDetailMaxSize = 60000

ThumbnailDraftMaxSize = 20000

Set the value to both of these settings to 5000000 as shown


Now that these values have been updated you can start Visio, open your document and re-save it and the preview that is embedded will be a high quality metafile.

NOTE: I suggest you set these values back to the defaults once you are finished creating your template preview.  If you leave these settings to force the high quality metafile all of your Visio diagrams will increase in filesize.

Copy the Preview to your template

If you have created your own previews for templates you know that it is a tedious task.  The preview is generated from the contents of the first page in your document so you have to build up the content for the preview on the first page of the document and save the document to generate the preview.  After this you probably want to remove the content from the first page of your document because this will be a template and in most cases you do not want the user to have to clear the page for each new document they create based on your template.  Not only do you have to clear the content from the first page, but you also have to set the LockPreview cell on the DocumentSheet so that when you re-save the document your nice preview is not overwritten with a new one based on your blank page.

You can automate this process by making use of the CopyPreviewPicture method that is on the Visio.Document object.  I have a Visio drawing (VSD) that I have setup just for creating previews for my templates.

- The first page is setup with a 10" x 10" size.  This size works well with the preview pane from the Getting Started task pane.

- The PreviewQuality cell on the DocumentSheet is already set to Detailed (1).

- The document contains VBA that is used to copy the preview of the current document to a specified target document.

To use this I follow the following steps:

  1. I make a copy of this document and name it to match the name of the template that I am generating a preview for.  This way I can reuse this as I develop new versions of my solution to keep my previews refreshed.

    Fantastic Network.vst

    Preview Designer - Fantastic Network.vsd

  2. I open this preview designer document and on the first page I create content within the 10" x 10" area.
  3. When I am happy with the content I choose save which will cause Visio to generate a new preview image for the current document.
  4. The last step is to run the CopyPreview macro from the Tools > Macros menu.  This macro asks me for the path and filename of the target Visio document that the preview will be copied to.

Remember that by default VBA is not trusted so you will need to enable VBA.

After the preview is copied to the template I can rebuild my setup (MSI) to include the updated template.

Click here to download my preview document that you can use to help you build your previews.


I have run into situations where Visio 2007 crashes when trying to save a file with a picture preview using these high quality metafile settings.

If you are using Visio shapes to create the preview:

  1. Try reducing the page size from the suggested 10” x 10” to something smaller like 5” x 5”.
  2. Try reducing the complexity of the shapes or the drawing.
    1. For example, formatting options such as gradient fills and dashed line types require a lot of space.

If you have any raster images (bmp, jpg, png) on the page you might need to use the default settings which will produce a bitmap preview instead of a metafile preview.


The procedures outlined in this article describe undocumented and unsupported features.

Comments (2)
  1. Thomas says:

    Great article!

    How could I also export all the open stencils I have in the preview designer.vsd open, to my destination document/template?

    I am looking for a vba script solution 🙂

    Thank you very much in advance.

Comments are closed.

Skip to main content