Avatar of Rebecca Shabad
Rebecca Shabad

asked on 

how do i open a file if i only know part of the file name

How to visible a filename*esy pattern related all files simultaneously from the directory. Please find the below code and suggest.

Const SOME_PATH As String = "C:\Anderson\"
Dim file As String
file = Dir(SOME_PATH & "filename*esy" & ".")

If (Len(file) > 0) Then
  MsgBox ("Found")
  Else
  MsgBox ("Not Found")
End If
End Sub

Open in new window

VBAMicrosoft Word

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon