Hi, i have this code below to open a file that contains the string Report.Test but i keep getting error msg that the file does not exist. Whats the problem here? The actual file name is 'Report.Test.Jan.csv'. Thank you for the help
![]()
Sub OpenFile() Dim File As String File = "Report.Test*" Dim DirFile As String DirFile = "C:\Temp\" & File If Dir(DirFile) = "" Then MsgBox "File does not exist" Else Workbooks.Open Filename:=DirFile End If End Sub
Bookmarks