是否可以更改文件夹扩展属性?

时间:2018-04-17 20:02:45

标签: windows vba

我一直在尝试使用可读的归档文件夹(以千字计数和以唯一标识符命名),而不使用外部数据库或应用程序。我想知道是否还有在Windows中添加/编辑文件夹(NOT FILES)的其他属性。由于名称无法更改,或许我可以在“客户”排序字段中嵌入有用的信息,例如。

我的实验和研究完全是空白。我假设这些信息是从文件中提取的元数据,因此无法在文件夹中使用?!如果是这种情况,或者我可以重新创建充满快捷方式的文件夹并将信息嵌入其中吗?

如果我的帖子不清楚,请参阅下文。

谢谢,霍华德

example folder window with additional sorting properties enabled

1 个答案:

答案 0 :(得分:0)

我将在这里工作(这将在消息中提示您要修改的信息):

Sub test()

    'Declare the variables
    Dim objFSO As Scripting.FileSystemObject
    Dim objTopFolder As Scripting.Folder
    Dim strTopFolderName As String
    Dim objFolder As Scripting.Folder
    Dim objSubFolder As Scripting.Folder

    'Your Top Folder Path
    strTopFolderName = "C:\Documents"

    'Create an instance of the FileSystemObject
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    'Get the top folder
    Set objTopFolder = objFSO.GetFolder(strTopFolderName)

    'with this you will get the folder name or other properties
    For Each objSubFolder In objTopFolder.SubFolders

      MsgBox objSubFolder.Name
      MsgBox objSubFolder.DateCreated

    Next objSubFolder

End Sub

仅供参考 - 您需要启用Microsoft Scriptime Runtime的引用。