Distributing Your Program

3 4

The files you distribute to your users depend on the type of solution you create. Typically, if you create a Microsoft Visual Basic for Applications (VBA) program that is stored within a template, you'll distribute only the template and its stencils (and the files the VBA program references, if any). If you create an external program, you might need to distribute the executable (EXE)file, a template, and stencils. If you create an add-on or Component Object Model (COM) add-in, you might need to distribute only the EXE file or Microsoft Visio library (VSL) file, or COM add-in (DLL) file. You'll also need to be aware of copyright issues if you distribute Visio shapes, as described later in this chapter.

For details on distributing COM add-ins, see Distributing COM Add-ins in Chapter 23, Using COM Add-ins in a Visio Solution.

Note


Microsoft Office Developer (2000 and XP) and Visual Basic 6.0 provide wizards for packaging and deployment that can help you create a setup package you can then deploy to users. For information, see your Microsoft Office Developer or Visual Basic product documentation.

Distributing Microsoft VBA Programs

VBA programs are stored in a Visio template, stencil, or drawing. The only file you typically need to distribute is a template (VST or VTX) or drawing (VSD or VDX) and its stencils (VSS or VSX). If your VBA project references other Visio files, you need to distribute those also. There is no separate program file for a VBA program.

This illustration displays the possible elements of a VBA solution.

figure 26-7. vba solution and its elements: template, stencil, and vba macros.

Figure 26-7 VBA solution and its elements: template, stencil, and VBA macros.

When a user creates a new document from a Visio file, Visio copies the VBA program to the new document and includes references to the same open stencils and other Visio files (if any).

Drawing File Size in a Microsoft VBA Solution

Determining where to store your VBA program can affect the size of the drawing file. You can store your program in a template, stencil, or drawing. Consider the following guidelines:

Although it's convenient to distribute, a template that contains a lot of VBA code can cause drawings to be much larger than necessary because the template's code is copied to each drawing created from the template. Such a template can also make a solution more difficult to maintain or upgrade, because each drawing has its own copy of the code.

If the purpose of the code is to help the user create a drawing, and it won't run again after that task is done, the template is probably still the best location for it. As an alternative, however, you can place the bulk of the code in a Visio stencil (VSS or VSX) and call it from the template. This helps conserve drawing file size and improves maintainability: You can simply distribute a new version of the stencil to upgrade your solution.

Using Universal Names in Your Solution

Beginning with Microsoft Visio 2000, any shape, master, page, style, row, or layer can be assigned a universal name in addition to its local name. A local name is a name, such as a shape name, that a user sees in the user interface. If your Automation solution will be localized (translated into another language), these names will often change for each location where they run.

Universal names are names that don't change when the solution is localized. Universal names do not appear in the user interface—only Automation clients can access Visio objects by their universal names. By using universal names in your source code, you can run your source code unchanged and avoid supporting multiple versions of your solution.

When an object is named for the first time, either in the user interface or through Automation, the universal name is set to the local name by default. After this original name is assigned, the following will apply:

  • Any name changes that are made in the user interface affect only the local name.
  • Universal names can be accessed or modified through the Automation interface only.

The properties and methods that you can use in your source code to refer to an object's universal name are found in the Visio type library with a suffix of "U."

To identify the properties and methods that reference universal names

  1. In the Object Browser, select the class that you are working with; for example, Page.
  2. In the list of class members, several properties and methods that will use the Page object's universal name are shown. For the Page object, they are: DropManyU, GetFormulasU, and NameU.

For details about using these properties and methods, see the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference).

Important Licensing Information

The stencils, masters, and templates provided with Visio are copyrighted material, owned by Microsoft Corporation and protected by United States copyright laws and international treaty provisions.

As a solutions developer, you cannot distribute any copyrighted master provided with Microsoft Visio or through a Web-based subscription service, unless your user already has a licensed copy of Visio that includes that master, or your user has a valid subscription to the Web-based service, or you've signed an agreement that allows you to distribute individual masters to your users. This includes shapes you create by modifying or deriving shapes from copyrighted masters.

The Microsoft Visual Basic and C++ files of constants and global functions provided on the Developing Microsoft Visio Solutions CD are also copyrighted. You can include these files in your projects and use them to build executable programs. You cannot, however, distribute them to other developers unless they already have a licensed copy of the Developing Microsoft Visio Solutions CD that includes these files.

To copyright your original shapes, select a shape, click Special on the Format menu, and then enter copyright information in the Copyright box. After you enter copyright information in the Special dialog box, it cannot be changed in a drawing, stencil, or template file.

Note


For complete details about licensing of masters and Visio products, see the End User License Agreement for Microsoft Software that is included with Visio.



Developing Microsoft Visio Solutions 2001
Developing Microsoft Visio Solutions (Pro-Documentation)
ISBN: 0735613532
EAN: 2147483647
Year: 2004
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net