VBA/Excel/Access/Word/File Path/Folder

Материал из VB Эксперт
Перейти к: навигация, поиск

Create folder

 
Sub cmdCreateFolder_Click()
    Dim myFileSystemObject As FileSystemObject
    Set myFileSystemObject = New FileSystemObject
    myFileSystemObject.CreateFolder ("c:\ttt")
End Sub



Folder information

 
Sub cmdFolderInfo_Click()
    Dim myFileSystemObject As FileSystemObject, curFolder As folder
    Set myFileSystemObject = New FileSystemObject
    Set curFolder = myFileSystemObject.GetFolder("c:\Java_Dev\")
    With curFolder
        Debug.Print "Created: " & .DateCreated & vbCrLf
        Debug.Print "Last Accessed: " & .DateLastAccessed & vbCrLf
        Debug.Print "Last Modified: " & .DateLastModified & vbCrLf
        Debug.Print "Size: " & Format(.Size / 1000#, "#0.00") & "KB"
    End With
    Set myFileSystemObject = Nothing
    Set curFolder = Nothing
End Sub