I found the below code module which lists the name of the latest modified file in a directory.

I want to get the latest modified file for a particular file type. For e.g., file types can be .csv, .pdf, .doc, .ppt, etc.
How can the below code be modified to do that ? Can someone help ?

Sub Get_Most_Recent_File()
    Dim FileSys As FileSystemObject
    Dim objFile As File
    Dim myFolder
    Dim myDir, strFilename As String
    Dim dteFile As Date

    ' Add a reference to the Microsoft Scripting Runtime.
    ' Goto Tools > References and check the Microsoft Scripting Runtime, scroll down until you see it.

    ' Set path for files - Change for your folder
    myDir = ThisWorkbook.Path

    ' Setup FileSystemObject
    Set FileSys = New FileSystemObject
    Set myFolder = FileSys.GetFolder(myDir)

    ' Loop through each file and get Last Modified Date. If largest date then Store name of the file
    dteFile = DateSerial(1900, 1, 1)
    For Each objFile In myFolder.Files
        If objFile.DateLastModified > dteFile Then
           dteFile = objFile.DateLastModified
           strFilename = objFile.Name
        End If
    Next objFile
    MsgBox strFilename

    Set FileSys = Nothing
    Set myFolder = Nothing
End Sub