CopyProfile 示例 |
使用 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 ' Get the profile's preferences 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 SubERRORTRAP: If Err.Description <> "" Then MsgBox "The default profile '" & SourceProfile & "' cannot be found, please use a different source profile." End If End Sub