Search For Ext in AppDir

I need to search my app.path dir for a file with ext. (.wrg) i just need the first filename it finds and if it finds more then just debug.print filename
thaburnerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
zzzzzoocConnect With a Mentor Commented:
Here's a quick example. Just change ext to "*.wrg".

Form1:
-----------------
Option Explicit
Private Sub Form_Load()
    Dim path As String
    Dim ext As String
    Dim file As String
    path = App.path
    If (Right$(path, 1) <> "\") Then
        path = path & "\"
    End If
    ext = "*.HTM"
    file = Dir(path & ext, vbNormal)
    Do Until file = vbNullString
        Debug.Print file
        file = Dir
    Loop
End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.