I'm using a VBA in a CAD package that saves its VBA macros in external projects.I'm trying to read the project file name using the Microsoft Visual Basic for Applications Extensibility 5.3 reference.
The code runs but is returning some UNC path for the file that does not exist on our network at this time. When I run it at home, it still reports the same path.
Does anyone know why this would happen?
Here is the code:
Sub ShowVbaProjectFolder()
Dim path As String
path = Application.path
Debug.Print "Application.Path '" & path & "'"
' The next statement uses the VBE Project reference
Dim oVB As VBProject
Set oVB = ExecutingVBProject
path = oVB.fileName
Debug.Print "VBA Project path '" & path & "'"
End Sub
The code runs but is returning some UNC path for the file that does not exist on our network at this time. When I run it at home, it still reports the same path.
Does anyone know why this would happen?
Here is the code:
Sub ShowVbaProjectFolder()
Dim path As String
path = Application.path
Debug.Print "Application.Path '" & path & "'"
' The next statement uses the VBE Project reference
Dim oVB As VBProject
Set oVB = ExecutingVBProject
path = oVB.fileName
Debug.Print "VBA Project path '" & path & "'"
End Sub