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

This article was previously published under Q236519
This article has been archived. It is offered "as is" and will no longer be updated.
Moderate: Requires basic macro, coding, and interoperability skills.

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.

MacroInstalls into the
$(WinSysPath)\Windows\System subdirectory in Microsoft Windows 95 (or later) or the \Winnt\System32 directory under Microsoft Windows NT and Microsoft Windows 2000.
$(WinSysPathSysFile)\Windows\System subdirectory in Windows 95 (or later) or the \Winnt\System32 directory in Windows NT and Windows 2000 as a system file; not removed when the application is removed.
$(WinPath)\Windows in Windows 95 (or later) or \Winnt in Windows NT and Windows 2000.
$(AppPath)Application directory specified by the user, or the DefaultDir value specified in the [SETUP] section of Setup.lst.
$(AppPath)\Samples\Samples subdirectory of the application directory.
path (e.g., C:\)Directory identified by path. Not recommended.
$(ProgramFiles)Directory to which applications are usually installed: C:\Program Files
$(CommonFiles)Common directory to which shared files are sometimes installed: C:\Program Files\Common Files
$(CommonFiles)\SubdirectoryC:\Program Files\Common Files\subdirectory
For example:
$(CommonFiles)\My Company\My Application
$(MSDAOPath)Location that is stored in the registry for Data Access Objects (DAO) components. You should not use this for your files.
If you are trying to add a custom workgroup security file to your package, see the following article:
241479 MOD2000: Package and Deployment Wizard Doesn't Have Option to Include the Workgroup Information File
For additional information about Access command line switches, click the article number below to view the article in the Microsoft Knowledge Base:
209207 ACC2000: How to Use Command-Line Switches in Microsoft Access

Article ID: 236519 - Last Review: 10/21/2013 22:55:39 - Revision: 1.1

Microsoft Office 2000 Developer Edition

  • kbnosurvey kbarchive kbappsetup kbhowto kbpdwizard kbwizard KB236519