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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top