Avatar of Christian Knell
Christian Knell
Flag for Germany asked on

How to set the file attribute "not indexed" in VBScript or VBA?

How can I set the "not indexed" file attribute programmatically in VB Script or VBA?

a) I can set the "not indexed" attribute of a file using the cmd command "attrib +i c:\test.txt". This works fine.
b) Unfortunately the FileSystemObject doesn't recognize this attribute. oFSO.GetFile("c:\temp\test.txt"). Attributes always returns the same value, independant of the "not indexed" value being set or not, whereas it recognizes the "archive" attribute for example.

Any ideas how to set the "not indexed" file attribute programmatically?

Thanks!
Chris
VB ScriptWindows OSVBAScripting Languages

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill Prew

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Christian Knell

ASKER
Thanks a lot, Bill! The code immediately worked 😃👍. Best regards! Chris
Bill Prew

Great, glad that was helpful, thanks for the feedback.

»bp
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck