GetProjectFilePath Example

Using Programming Languages other than VBA

Sub Example_GetProjectFilePath()
	' This example finds the current project file information.

	Dim preferences As AcadPreferences
	Set preferences = ThisDrawing.Application.preferences

	' Get the current project file information
	Dim currProjPath As String
	Dim currProjName As Variant
	currProjName = ThisDrawing.GetVariable("PROJECTNAME")
	If currProjName <> "" Then
		currProjPath = preferences.Files.GetProjectFilePath(currProjName)
	End If
	If currProjPath = "" Then
		MsgBox "There is no current project file or path. ", , "GetProjectFilePath Example"
		MsgBox "The current project file path is: " & currProjPath, , "GetProjectFilePath Example"
	End If
End Sub