MainDictionary Example

Using Programming Languages other than VBA

Sub Example_MainDictionary()
	' This example returns the current setting of
	' MainDictionary. It then changes the value, and finally
	' it resets the value back to the original setting.

	Dim preferences As AcadPreferences
	Dim currMainDictionary As String
	Dim newMainDictionary As String

	Set preferences = ThisDrawing.Application.preferences

	' Retrieve the current MainDictionary value
	currMainDictionary = preferences.Files.MainDictionary
	MsgBox "The current value for MainDictionary is " & currMainDictionary, vbInformation, "MainDictionary Example"

	' Change the value for MainDictionary
	newMainDictionary = "TestMainDictionary"
	preferences.Files.MainDictionary = newMainDictionary
	MsgBox "The new value for MainDictionary is " & newMainDictionary, vbInformation, "MainDictionary Example"

	' Reset MainDictionary to its original value
	preferences.Files.MainDictionary = currMainDictionary
	MsgBox "The MainDictionary value is reset to " & currMainDictionary, vbInformation, "MainDictionary Example"
End Sub

 

   Comments?