Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
MOD2000: How to Write Macros and Switches for Shortcuts in the Package and Deployment Wizard
Article ID: 236519 - View products that this article applies to.
This article was previously published under Q236519
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 WizardIMPORTANT: 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" /CompactRepairing the database:
"$(AppPath)\NWIND.MDB" /RepairAlways 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 AlsoMicrosoft 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.
Collapse this tableExpand this table
If you are trying to add a custom workgroup security file to your package, see the following article:
241479For additional information about Access command line switches, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/241479/EN-US/ )MOD2000: Package and Deployment Wizard Doesn't Have Option to Include the Workgroup Information File
(http://support.microsoft.com/kb/209207/EN-US/ )ACC2000: How to Use Command-Line Switches in Microsoft Access