Hello everyone,

I am looking for a way to get hidden files fron
a folder and then list them in a listbox control.
Could someone help me with this?
this is the code i got so far:

Sub hidden(path As String, list As ListBox)
mypath = path
MyName = Dir(mypath, vbHidden)
Do While MyName <> ""
If MyName <> "." And MyName <> ".." Then
If (GetAttr(mypath & MyName) And vbHidden) = vbHidden Then
list.AddItem mypath & MyName
End If
End If
MyName = Dir
End Sub

but i get an error with this code, what do i have wrong?

Thanks in advance

8 Years
Discussion Span
Last Post by C0DER

What is the error? (err.number and err.description please)

Variable not defined??? mypath is not declared as a string as far as we can see so add Dim MyPath As String. Same goes for MyName...

Good Luck


This is how i call this code:

hidden "My Path"

Then i get this error:

Compile error:
Argument not optional


Hey never mind, i fix my code, i got it up and running.
Thank you anyway.

replys take too long in this forum.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.