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






Class Module: FullName

 
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)
    'Everything before the : is the drive
    mstrDrive = Left(strFile, _
        InStr(strFile, ":"))
End Sub

Private Sub GetPath(ByVal strFile As String)
    'Everything up until the last backslash
    'is the path
    mstrPath = _
        Mid(strFile, 1, InStrRev(strFile, "\"))
End Sub

Private Sub GetName(strFile)
    'Everything after the last backslash
    'is the name
    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: FileInformation
4.The SimpleLoan Class
5.Loan Object Implementation Details
6.Rectangle class
7.Creating the MyRectangle Class
8.Abstraction