次の方法で共有


Writing a Macro Manually (Windows CE 5.0)

Send Feedback

You can manually create a macro if you do not want to edit an existing one. With the macro editor, you can edit a macro or add to a macro you have recorded.

To write a macro

  1. From the Tools menu, choose Macro.

  2. Choose Options; choose New File to add the macro to a new macro file, type a name and a description for the file, and then choose OK.

    - or -

    In the MacroFile box, select the file name to add the macro to a file.

    If the file name is not in the list, install the file and then select it in the MacroFile box.

  3. In the Macro Name box, type a name for the macro.

  4. Choose Edit.

    You cannot create a macro in a read-only file, but you can browse an existing macro in a read-only file.

  5. In the AddMacro dialog box, type a description of the macro; then choose OK.

    The macro file opens and a SUB block is created for the macro at the end of the file.

    The following code example shows the SUB block for a macro named MyMacro.

    Sub MyMacro()
    'Description: The macro description goes here.
    
    'TODO: Insert the macro code here.
    End Sub
    
  6. (Conditional) If you use variables in the macro, declare the variables by using the VBScript DIM statement.

    You can be reminded to declare variables before using them by adding OPTION EXPLICIT at the beginning of each macro file.

See Also

Macros and Add-ins

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.