 <p>Have you tried to look at this one?</p> <pre><code>Dim PathofYourFile As String = "c:\MyDirectory\MYFile.txt" Dim FileName As String = IO.Path.GetExtension(PathofYourFile) MsgBox(FileName) </code></pre>