VBA Dir statement problem

Function OnClick(ByRef ClickData) Set f = clickData.func.sourcetab.selected_dirs(0) 'msgbox f Dir(f) End Function

This code snippet on a button sets a variable f as the selected directory, and it works fine

But when I try to use the Dir command with f as the directory for the command to use I get the dreaded "Type Mismatch"

Even if I type in the directory name between quotes I still get the "Type Mismatch"

Any of you VB gurus any ideas? How can I return the filename of the first file in the directory? Surely that is what the Dir command is for.

There's no Dir function in vbs as far as I know.

There is a Dir function in VBA apparently, but after much research I have discovered it only works in Excel. Sorry to have troubled you. It's back to the drawing board

Opus has built-in support for reading directories via the FSUtil object.