Compartilhar via


_Application.MacroOptions Method

Corresponds to options in the Macro Options dialog box. You can also use this method to display a user defined function (UDF) in a built-in or new category within the Insert Function dialog box.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Sub MacroOptions ( _
    Macro As Object, _
    Description As Object, _
    HasMenu As Object, _
    MenuText As Object, _
    HasShortcutKey As Object, _
    ShortcutKey As Object, _
    Category As Object, _
    StatusBar As Object, _
    HelpContextID As Object, _
    HelpFile As Object _
)
'Usage
Dim instance As _Application
Dim Macro As Object
Dim Description As Object
Dim HasMenu As Object
Dim MenuText As Object
Dim HasShortcutKey As Object
Dim ShortcutKey As Object
Dim Category As Object
Dim StatusBar As Object
Dim HelpContextID As Object
Dim HelpFile As Object

instance.MacroOptions(Macro, Description, _
    HasMenu, MenuText, HasShortcutKey, _
    ShortcutKey, Category, StatusBar, _
    HelpContextID, HelpFile)
void MacroOptions(
    Object Macro,
    Object Description,
    Object HasMenu,
    Object MenuText,
    Object HasShortcutKey,
    Object ShortcutKey,
    Object Category,
    Object StatusBar,
    Object HelpContextID,
    Object HelpFile
)

Parameters

  • Macro
    Type: System.Object

    Optional Object. The macro name or the name of a user defined function (UDF).

  • Description
    Type: System.Object

    Optional Object. The macro description.

  • HasMenu
    Type: System.Object

    Optional Object. This argument is ignored.

  • MenuText
    Type: System.Object

    Optional Object. This argument is ignored.

  • HasShortcutKey
    Type: System.Object

    Optional Object. True to assign a shortcut key to the macro (ShortcutKey must also be specified). If this argument is False, no shortcut key is assigned to the macro. If the macro already has a shortcut key, setting this argument to False removes the shortcut key. The default value is False.

  • ShortcutKey
    Type: System.Object

    Optional Object. Required if HasShortcutKey is True; ignored otherwise. The shortcut key.

  • Category
    Type: System.Object

    Optional Object. An integer that specifies an existing macro function category (Financial, Date & Time, or User Defined, for example). See the remarks section to determine the integers that are mapped to the built-in categories. You can also specify a string for a custom category. If you provide a string, it will be treated as the category name that is displayed in the Insert Function dialog box. If the category name has never been used, a new category is defined with that name. If you use a category name that is that same as a built-in name, Excel will map the user defined function to that built-in category.

  • StatusBar
    Type: System.Object

    Optional Object. The status bar text for the macro.

  • HelpContextID
    Type: System.Object

    Optional Object. An integer that specifies the context ID for the Help topic assigned to the macro.

  • HelpFile
    Type: System.Object

    Optional Object. The name of the Help file that contains the Help topic defined by HelpContextId.

Remarks

The following table lists which integers are mapped to the built-in categories that can be used in the Category parameter.

Integer

Category

1

Financial

2

Date & Time

3

Math & Trig

4

Statistical

5

Lookup & Reference

6

Database

7

Text

8

Logical

9

Information

10

Commands

11

Customizing

12

Macro Control

13

DDE/External

14

User Defined

15

First custom category

16

Second custom category

17

Third custom category

18

Fourth custom category

19

Fifth custom category

20

Sixth custom category

21

Seventh custom category

22

Eighth custom category

23

Ninth custom category

24

Tenth custom category

25

Eleventh custom category

26

Twelfth custom category

27

Thirteenth custom category

28

Fourteenth custom category

29

Fifteenth custom category

30

Sixteenth custom category

31

Seventeenth custom category

32

Eighteenth custom category

See Also

Reference

_Application Interface

_Application Members

Microsoft.Office.Interop.Excel Namespace