3

Using this link I was able to write a program in vba that reads extended file properties. Now, I'd like to make a program that can edit extended file properties - specifically property 22, the "subject" of a file. So, given a file path, how could you edit the subject associated with that file?

4

3 回答 3

3

用你现在用的方法是做不到的。您可以安装和使用 Microsoft ActiveX dsofile.dll来获取和设置使用 VBScript 的扩展属性。

Set objFile = CreateObject("DSOFile.OleDocumentProperties")
objFile.Open("C:\My Path\MyFile.doc")
objFile.SummaryProperties.Subject = "My Subject"
objFile.Save
set objFile = Nothing
于 2013-06-07T20:45:40.537 回答
0

这实际上更像是对上面 jac 的评论。引用的 .dll 文件在 64 位机器上不起作用,我觉得今天大多数机器都是 64 位的。单击此处获取与引用的 dsofile.dll 等效的开源 64 位。

于 2019-09-12T06:13:44.850 回答
-2

' 将文件设为只读

SetAttr "c:\temp\Sample.txt", vbReadOnly

' 隐藏文件

SetAttr "c:\temp\Sample.txt", vbHidden

' 请注意,如果您更改一个属性,现有的属性将被覆盖。要将文件设为只读和隐藏,请在函数中使用这两个属性

SetAttr "c:\temp\Sample.txt", vbHidden + vbReadOnly

' 删除所有属性 - 将只读文件转换为读写文件,取消隐藏文件等

SetAttr "c:\temp\Sample.txt", vbNormal
于 2016-03-02T06:23:38.077 回答