Members that Enable Excel Features

Several Application members enable or disable certain Excel features:

AutoFormatAsYouTypeReplaceHyperlinks property (R/W Boolean)

Set to True to have Excel automatically format hyperlink text as a hyperlink. Set to False to turn off this often-annoying feature of Excel.

EnableAnimations property (R/W Boolean)

This property determines whether animated insertion and deletion is enabled. When animation is enabled, inserted worksheet rows and columns appear slowly and deleted worksheet rows and columns disappear slowly. The default value is False.

EnableAutoCompleteproperty (R/WBoolean)

This property determines whether Excel's AutoComplete feature is enabled; its default value is True.

EnableCancelKeyproperty (R/WLong)

This property controls how Excel handles the Ctrl -Break or Esc key combinations during a running procedure. It can be one of the following XlEnableCancelKey constants:

Enum XlEnableCancelKey xlDisabled = 0 xllnterrupt = 1 xlErrorHandler = 2 End Enum

The meanings of these constants follow:

xlDisabled

Trapping is disabled (the keystrokes are ignored).

xllnterrupt

The running procedure is interrupted by the display of a dialog box that enables the user to either debug or end the procedure. This is the default value.

xlErrorHandler

The keystroke interrupt is sent to the running procedure as an error that is trappable by an error handler using the On Error GoTo statement. The error code is 18.

Note that this property can be dangerous and should be used with great circumspection. In particular, if you set the property to xlDisabled, then there is no way to interrupt an infinite loop. Similarly, if you set the property to xlErrorHandler but your error handler returns using the Resume statement, there is no way to stop nonself-terminating code.

For these reasons, Excel always resets the EnableCancelKey property to xllnterrupt whenever Excel returns to the idle state and there is no code running.

EnableEvents property (R/WBoolean)

This property is True (its default value) if events are enabled for the Application object. (For more on this, see Chapter 11.)

EnableSoundproperty (R/WBoolean)

This property enables and (mercifully) disables sounds for Microsoft Office. The default value is False.

0 0

Post a comment