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?

3 Answers 3

3

It can't be done using the method you are using now. You can install and use the Microsoft ActiveX dsofile.dll to both get and set extended properties using VBScript.

Set objFile = CreateObject("DSOFile.OleDocumentProperties")
objFile.Open("C:\My Path\MyFile.doc")
objFile.SummaryProperties.Subject = "My Subject"
objFile.Save
set objFile = Nothing
Sign up to request clarification or add additional context in comments.

Comments

0

This is really more of a comment to jac above. The .dll file referenced won't work on 64 bit machines, and I feel most machines today are 64 bit. Click Here for an open source 64 bit equivalent to the referenced dsofile.dll.

Comments

-2

' Make the file Read-Only

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

' Make the file Hidden

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

' Please note that if you change one attribute, the existing attribute is overwritten. For making a file as both readonly and hidden use both attributes in the function

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

' Remove all atributes - convert a read-only file to read-write file, unhide the file etc

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

2 Comments

Why is my answer downvoted? Can anyone please comment? So that I can fix or improve the answer
Way delayed, but you are talking about attributes. OP is talking about extended file properties... (On Windows: right click on a file in the File Explorer, select properties, and switch to the details tab)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.