ForeverStuck
ForeverStuck

Reputation: 45

Invalid Qualifier when using System.IO.path in VBA

I'm extremely new to vba and feel like I have been falling down at the first hurdle all morning. I'm trying to get the path of my access file by doing the following

Sub getDirectoryPath()
    Debug.Print (System.IO.path.GetFullPath())
End Sub

However I get an "Invalid Qualifier" error on System when I try to run it. I've tried adding the 'System' reference but then it says IO is not found. What am I doing wrong?

Upvotes: 0

Views: 1832

Answers (1)

Madgui
Madgui

Reputation: 425

VBA environment has only access to COM (and COM visible) component.
So forget about importing usual .Net namespaces.
But some Wrappers exists : [https://technet.microsoft.com/en-us/magazine/2007.01.heyscriptingguy.aspx]
For instance this works :

DataList = CreateObject("System.Collections.ArrayList")

BTW, in order to parse file full name in VBA, you can use FileSystemObject.

Upvotes: 1

Related Questions