Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

MakeFileName - Create a file name out of its parts

Total Hit ( 1857)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 



Click here to copy the following block
' Make a complete file name by assemblying its individual parts
' if Extension isn't omitted, it overwrites any extension held in BaseName

Function MakeFileName(Drive As String, Path As String, BaseName As String, _
  Optional Extension As String)

  ' add a trailing colon to the drive name, if needed
  MakeFileName = Drive & IIf(Right$(Drive, 1) <> ":", ":", "")
  ' add a trailing backslash to the path, if needed
  MakeFileName = MakeFileName & Path & IIf(Right$(Path, 1) <> "\", "\", "")
  
  If Len(Extension) = 0 Then
    ' no extension has been provided
    MakeFileName = MakeFileName & BaseName
  ElseIf InStr(BaseName, ".") = 0 Then
    ' the base name doesn't contain any extension
    MakeFileName = MakeFileName & BaseName & "." & Extension
  Else
    ' we need to drop the extension in the base name
    Dim i As Long
    For i = Len(BaseName) To 1 Step -1
      If Mid$(BaseName, i, 1) = "." Then
        MakeFileName = MakeFileName & Left$(BaseName, i) & Extension
        Exit For
      End If
    Next
  End If
End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.