DeleteProfile Method (ActiveX)

Deletes the specified profile.

Supported platforms: Windows only

Signature

VBA:

object.DeleteProfile ProfileName
object

Type: PreferencesProfiles

The object this method applies to.

ProfileName

Access: Input-only

Type: String

The name of the profile to delete.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DeleteProfile()
    ' This example deletes a profile.
    
    Dim preferences As AcadPreferences
    Dim strProfileToDelete As String
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Specify the profile to delete.
    strProfileToDelete = "TestProfile"
    
    ' Delete the profile
    ' The call will fail if "TestProfile" does not exist or
    ' if "TestProfile" is the current profile.
    On Error GoTo Error
    preferences.Profiles.DeleteProfile strProfileToDelete
    Exit Sub

Error:
    MsgBox "DeleteProfile of " & strProfileToDelete & " failed. " & Err.Description, , "DeleteProfile Example"
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteProfile()
    ;; This example deletes a profile.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Specify the profile to delete.
    (setq strProfileToDelete "TestProfile")
    (vla-CopyProfile (vla-get-Profiles preferences) "<<Unnamed Profile>>" strProfileToDelete)

    (alert (strcat "Profile " strProfileToDelete " created from <<Unnamed Profile>>."))
    
    ;; Delete the profile
    ;; The call will fail if "TestProfile" does not exist or
    ;; if "TestProfile" is the current profile.
    (vla-DeleteProfile (vla-get-Profiles preferences) strProfileToDelete)
    (alert (strcat "Profile " strProfileToDelete " deleted."))
)