ExpressionStore.RenameExpression
Use this method to rename an existing expression in the expression store. The new expression name must be unique or the operation will fail.
Definition
Sub RenameExpression(nExprID As Long,strNewName As String)
Parameters
nExprID
[in] A Long that contains the expression ID.
strNewName
[in] A String that contains the new name.
Return Values
None.
Error Values
This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
The following table shows the custom COM errors that this method can return.
Constant | Value | Description |
E_EXPR_BADCONNECTION | &H8110001F | Invalid connection |
E_EXPR_BADEXPRID | &H8110000A | Invalid expression ID specified, or expression ID not found in store |
E_EXPR_BADEXPRNAME | &H81100003 | Invalid expression name |
E_EXPR_DUPEXPRNAME | &H81100007 | Duplicate expression name |
E_EXPR_INVALIDFIELDSIZE | &H81100005 | The new name exceeds the maximum size of 30 characters |
E_EXPR_NOCONNECTIONSTRING | &H8110000D | No connection string specified |
Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.
Remarks
Use the GetExprID method to translate an expression name to its corresponding expression ID.
Call the Connect method before calling the RenameExpression method.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.
Example
' oExpressionStore is an ExpressionStore object connected to
' a valid expression store.
' 52997 is a valid expression ID retrieved from the GetExprId method.
oExpressionStore.RenameExpression(52997, "MyNewName")