RenameProfile メソッド(ActiveX)

指定されたプロファイルの名前を変更します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.RenameProfile origProfileName, newProfileName
object

タイプ: PreferencesProfiles

このメソッドが適用されるオブジェクト。

origProfileName

アクセス: 入力のみ

タイプ: 文字列

現在のプロファイル名。

newProfileName

アクセス: 入力のみ

タイプ: 文字列

プロファイルの新しい名前。

戻り値(RetVal)

戻り値はありません。

注意

追加の注意はありません。

VBA:

Sub Example_RenameProfile()
    ' This example renames an existing profile.
    ' You can see the renamed 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
    
    ' Get the profiles preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Profiles
    
    ' Rename the default profile
    On Error GoTo ERRORTRAP
    
    SourceProfile = "<<Unnamed Profile>>"
    DestinationProfile = "NEW_PROFILE_NAME"
        
    ACADPref.RenameProfile SourceProfile, DestinationProfile

    MsgBox "We have just renamed the 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_RenameProfile()
    ;; This example renames an existing profile.
    ;; You can see the renamed 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))

    ;; Rename the default profile
    (setq sourceProfile "<<Unnamed Profile>>"
          destinationProfile "NEW_PROFILE_NAME")
  
    (setq err (vl-catch-all-apply 'vla-RenameProfile (list (vla-get-Profiles preferences) sourceProfile destinationProfile)))

    (if (= (type err) 'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "The default profile '" SourceProfile "' cannot be found, please use a different source profile."))
        (alert (strcat "We have just renamed the profile " SourceProfile " to " DestinationProfile))
    )
)