Microsoft KB Archive/236519

= MOD2000: How to Write Macros and Switches for Shortcuts in the Package and Deployment Wizard =

Article ID: 236519

Article Last Modified on 7/30/2001

-

APPLIES TO


 * Microsoft Office 2000 Developer Edition

-



This article was previously published under Q236519



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
With the Package and Deployment Wizard in Microsoft Office 2000 Developer Edition, you can use special keywords called Macros. These words enable you to create a shortcut path to point to components on the target computer where you want to install your application.

For example, you may want a shortcut for your application to always point to a file in the application's subdirectory. However, you may not know into what path the user may install the application. You can use the $(AppPath) macro to solve this problem because the macro enables you to ensure that the shortcut points to a file in the directory where the application is installed. When the package is installed, the $(AppPath) macro is translated into the hard-coded path of the application directory, and the resulting shortcut contains that path.

This article discusses the basic rules for using these macros, and also includes a table of what macros are available in the Package and Deployment Wizard.



Rules for Writing Command Lines in the Wizard
IMPORTANT: Be sure to place quotation marks, switches, and macros in the proper places.

Rule 1: Command Line Switches Need Proper Placement:
Usually any switches come just after the executable file, as in the following example:

C:\Program Files\Office\Msaccess.exe /wrkgrp "C:\Program Files\NWIND\System.mdw"

However, the Package and Deployment Wizard does not require that you enter a path to the executable file. When you use a macro, the Package and Deployment Wizard determines the path when the user is installing the application. When you create a shortcut in the Package and Deployment Wizard, put switches and the path to the database in the proper location, as in the following examples.

Specifying a workgroup file:

/wrkgrp "$(AppPath)\System.mdw" "$(AppPath)\NWIND.MDB"

Compacting the database:

"$(AppPath)\NWIND.MDB" /Compact

Repairing the database:

"$(AppPath)\NWIND.MDB" /Repair

Always run the application in run-time mode (even if the user has the full retail version of Access):

/Runtime "$(AppPath)\NWIND.MDB"

NOTE: In these examples, note that you do not enclose the switches in quotation marks. You only enclose the paths in quotation marks.

Rule 2: Enclose Each Path in Quotation Marks.
If your command line contains more than one path, such as when you specify a workgroup information file and a database name, enclose each path in quotation marks in case the path contains spaces or long file names. You cannot put quotation marks around the entire line or around more than one path. What follows is an example that is incorrect, and then an example that is correct.

The following example is incorrect because more than one path is inside one set of quotation marks:

/wrkgrp "$(AppPath)\System.mdw $(AppPath)\NWIND.MDB"

NOTE: If you put the two paths inside one set of quotation marks, the second $(AppPath) is ignored by Setup, and the shortcut that results will not work on the user's computer.

The following example of a target file command-line string is correct because each path is inside its own set of quotation marks:

/wrkgrp "$(AppPath)\System.mdw" "$(AppPath)\NWIND.MDB"

NOTE: The path to Msaccess.exe is added automatically during package installation and is not needed in this target file command-line string.

Rule 3: Enclose Macros in Quotation Marks Also
Microsoft Access switches are not enclosed in quotation marks. However, Package and Deployment Wizard macros are enclosed in quotation marks, as shown in the examples under Rule 2.

The following is a table of macros available for the command lines of shortcuts in the Package and Deployment Wizard.

