1

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

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by C0DER
0

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

0

This is how i call this code:

hidden "My Path"

Then i get this error:

Compile error:
Argument not optional

0

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.