CopyProfile Method (ActiveX)

Copies the specified profile.

Supported platforms: Windows only

Signature

VBA:

object.CopyProfile oldProfileName, newProfileName
object

Type: PreferencesProfiles

The object this method applies to.

oldProfileName

Access: Input-only

Type: String

The name of the profile to copy.

newProfileName

Access: Input-only

Type: String

The name of the new profile to be created.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CopyProfile()
    ' This example copies an existing profile.
    ' You can see the new profile under Options/Profiles
    '
    ' *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ' If this profile has already been renamed or removed, be sure to change the
    ' name of the SourceProfile to one that currently exists.
    
    Dim ACADPref As AcadPreferencesProfiles
    Dim SourceProfile As String, DestinationProfile As String
    
    ' Use the PreferencesProfiles object
    Set ACADPref = ThisDrawing.Application.Preferences.Profiles
    
    ' Copy the default profile
    On Error GoTo ERRORTRAP
    
    SourceProfile = "<<Unnamed Profile>>"
    DestinationProfile = "NEW_PROFILE"
    
    ACADPref.CopyProfile SourceProfile, DestinationProfile
    
    MsgBox "We have just copied the existing profile " & SourceProfile & " to " & DestinationProfile
    
    Exit Sub
    
ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox "The default profile '" & SourceProfile & "' cannot be found, please use a different source profile."
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyProfile()
    ;; This example copies an existing profile.
    ;; You can see the new profile under Options/Profiles
    ;;
    ;; *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ;; If this profile has already been renamed or removed, be sure to change the
    ;; name of the SourceProfile to one that currently exists.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
  
    ;; Use the PreferencesProfiles object
    (setq ACADPref (vla-get-Profiles preferences))
    
    (setq SourceProfile "<<Unnamed Profile>>"
          DestinationProfile "NEW_PROFILE")
    
    (vla-CopyProfile ACADPref SourceProfile DestinationProfile)
    
    (alert (strcat "We have just copied the existing profile " SourceProfile " to " DestinationProfile))
)