VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Here is how to get the App.Path in AutoCAD VBA

0 REPLIES 0
Reply
Message 1 of 1
Patch61
1039 Views, 0 Replies

Here is how to get the App.Path in AutoCAD VBA

I came up with these routines for getting the path to the current project's .dvb file and also to extract just the path from a full path and filename, for AutoCAD VBA. I split this into separate functions because I thought that the GetPathFromFilename function could be useful in other places. I hope others find these useful.

 

Public Function App_Path() As String

  'Works like app.path in VB

  Dim str As String

  str = ThisDrawing.Application.VBE.ActiveVBProject.Filename

  App_Path = GetPathFromFilename(str)

End Function

 

Public Function GetPathFromFilename(sFile) As String

  Dim arr() As String

  arr = Split(sFile, "\", -1, vbTextCompare)

  GetPathFromFilename = Left(sFile, Len(sFile) - Len(arr(UBound(arr))))

End Function

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost