Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » API

Post new topic   Reply to topic
Find the extension of a file
View previous topic :: View next topic  
Author Message
sprog90
Newbie


Joined: 21 Jul 2005
Posts: 20

PostPosted: Apr 18th, 2006 02:40 AM    Post subject: Find the extension of a file Reply with quote

Is there a way to find the extension of a file (e.g. .doc, .txt etc)? Confused
Back to top
View user's profile Send private message Send e-mail Visit poster's website
smart
Newbie


Joined: 19 Apr 2006
Posts: 6

PostPosted: Apr 19th, 2006 03:43 AM    Post subject: Reply with quote

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(Cool & strEx
Next

MsgBox strTmp

End Sub
-------------------------------------------
_________________
Nothing To Lose!
Back to top
View user's profile Send private message
sprog90
Newbie


Joined: 21 Jul 2005
Posts: 20

PostPosted: Apr 19th, 2006 04:52 AM    Post subject: Reply with quote

Thanks you very very much. I really need this code! Biggrin
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » API All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic