Hi Is it possible to get VBA path from where it was loaded into autocad? Birger
You'll need to add a reference to: Microsoft Visual Basic for Applications Extensibility 5.3 Then add the following code to a module. Sub test() Dim VBInstance As VBIDE.VBE Set VBInstance = ThisDrawing.Application.VBE MsgBox VBInstance.ActiveVBProject.FileName End Sub This will give you the full file name, including the path.
hello this works when I am only using one VBA program. When I use it then use another VBA program then back to the program that uses this code it wants to return the name of the other program. Not good. any suggestions. David Urban
Hallo, you can test a name of your project (see example) 'gives dvb dir Public Function getDVBDir(dvbName As String) As String Dim selDir As String Dim selFile As String Dim ipr As Long On Error Resume Next For ipr = 1 To Application.VBE.VBProjects.count If UCase(Application.VBE.VBProjects(ipr).name) = UCase(dvbName) Then selFile = Application.VBE.VBProjects(ipr).fileName selDir = predLom(selFile) getDVBDir = selDir End If Next ipr End Function Regards Josef