Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office Groove
Search
Search
 
Check for updates: (c) Microsoft
Office downloads
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Adding macros to a custom tool
 

Macros are script programs run by the user. Macros perform automated operations on a set of records and can automate bulk operations that would be inconvenient for the user to perform on many individual records. Users run macros by selecting them from the Run Macro menu in a data view.

What do you want to do?


Adding a new macro

  1. Open the Designer.
  2. Expand the Macros section in the Design Object Pane, and click Create New Macro...
  3.  Note    If you don't see a Macros section, check the Show Advanced Design Features box.

  4. Enter a name for the macro.
  5. This name will display in the Run Macro drop-down menu in the toolbar.

  6. Select an implementation language from the Language drop-down menu.
  7. Select an option to define the scope of the macro (for example, "All records" or "Selected records".
  8. Add the required macro code in the code window.
  9. To help you keep your macro code organized, you can add code to the More Code window (Click More Code). This is useful for setting up code for calling functions and declaring global variables.

    You can also add lookup strings: Click Create Lookup String, select your lookup targets in the dialog box, and click Copy. The Lookup string code is placed on the clipboard. You can then paste it into your macro code.

     Note   You cannot perform a lookup on records stored in a Forms tool in another workspace.

  10. If you want, select options for restricting access to the macro.
  11. Save your changes.

When the user runs a macro, it is called once for each record in the set. Note that global variables are initialized before the first record in the set and retain their value from one record to the next. The order in which the macro is called for each record in the set is undefined.

In the macro code, access to the Forms tool record is provided by the i_FormRecord parameter. You can use the record to read or set the record's fields or to get the parent record. Access to the Forms tool services is provided through the i_FormsToolUIDelegate parameter. Additional context information is provided by the global functions in the Public.js script.

Top of Page Top of Page

Restricting access to macros

A custom tool designer can restrict access to macros in the following ways:

Making a macro available only to selected members

You can make selected macros available to members depending on their roles. You can also make selected macros available to selected members regardless of their role.

  1. Open the Designer.
  2. Expand the Macros section and select the macro you want to modify.
  3. Click the Access tab.
  4. Do any of the following:
    • Check the member roles you want to allow to run the macro.
    • In the Member list, check members you want to allow to run the macro regardless of their role.
  5. Save your changes.

Top of Page Top of Page

advertisement