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
Loop
End Sub

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

Thanks in advance

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.