| View previous topic :: View next topic |
| Author |
Message |
sprog90 Newbie

Joined: 21 Jul 2005 Posts: 20
|
Posted: Apr 18th, 2006 02:40 AM Post subject: Find the extension of a file |
|
|
Is there a way to find the extension of a file (e.g. .doc, .txt etc)?  |
|
| Back to top |
|
smart Newbie
Joined: 19 Apr 2006 Posts: 6
|
Posted: Apr 19th, 2006 03:43 AM Post subject: |
|
|
First :
Project -> adduction -> Microsoft Scripting Runtime
-------------------------------
Dim LfileSys As New Scripting.FileSystemObject
Private Sub Command1_Click()
Dim Lfiles As Files
Dim lfile As File
Dim i As Integer
Dim strEx As String
Dim strTmp As String
Set Lfiles = LfileSys.GetFolder("D:\").Files
For Each lfile In Lfiles
i = InStrRev(lfile.Name, ".")
strEx = Right(lfile.Name, Len(lfile.Name) - i + 1)
strTmp = strTmp & vbCrLf & "FileName: " & lfile.Name & Space( & strEx
Next
MsgBox strTmp
End Sub
------------------------------------------- _________________ Nothing To Lose! |
|
| Back to top |
|
sprog90 Newbie

Joined: 21 Jul 2005 Posts: 20
|
Posted: Apr 19th, 2006 04:52 AM Post subject: |
|
|
Thanks you very very much. I really need this code!  |
|
| Back to top |
|
|