Class Module: FileInformation : Class « Data Type Functions « VBA / Excel / Access / Word






Class Module: FileInformation

 
Private mstrFullFileName As String
Private mstrDrive As String
Private mstrPath As String
Private mstrName As String

Public Property Get FullFileName() As String
   FullFileName = mstrFullFileName
End Property

Public Property Let FullFileName(ByVal strFileName As String)
   Call GetDrive(strFileName)
   Call GetPath(strFileName)
   Call GetName(strFileName)
End Property

Public Property Get Drive() As String
   Drive = mstrDrive
End Property

Public Property Get Path() As String
   Path = mstrPath
End Property

Public Property Get Name() As String
   Name = mstrName
End Property

Private Sub GetDrive(ByVal strFile As String)
    mstrDrive = Left(strFile, InStr(strFile, ":"))
End Sub

Private Sub GetPath(ByVal strFile As String)
    mstrPath = Mid(strFile, 1, InStrRev(strFile, "\"))
End Sub

Private Sub GetName(strFile)
    mstrName = Mid(strFile, InStrRev(strFile, "\") + 1)
End Sub

 








Related examples in the same category

1.Creating Custom Objects
2.Creating and Using a Class Module
3.Class Module: FullName
4.The SimpleLoan Class
5.Loan Object Implementation Details
6.Rectangle class
7.Creating the MyRectangle Class
8.Abstraction