Microsoft Visual Basic for Applications

Joined
Aug 21, 2009
Messages
1
Reaction score
0
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
 
Back
Top