Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove read only attribute (2003)

    Hi all,

    I am trying to figure out a way to remove the readonly attribute of a file, when it is moved from one location to the next.

    I am using a script to copy the files to there new location and append files with the same filename, but so of the files are readonly, so when they append they wont save. Is there a way to remove this attribute during the copy process.

    Many thanks
    Regards
    Gerbil (AKA Kevin)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove read only attribute (2003)

    Let's say that you have a string variable strFile that contains the path and filename of a file. The following VBA instruction will remove the Read-Only attribute from the file (if it has been set):

    SetAttr strFile, GetAttr(strFile) And Not vbReadOnly

  3. #3
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove read only attribute (2003)

    Thanks Hans, that works for what you meant it too, unfortunatley I did not explain myself very well.

    I mean the 'Read Only Reccomended' tick box with the security settings, when the file was saved.

    Although looking at how the file opens, it does give me a choice of yes to open read only and no to open normal. The script I have been using to open the files and append duplicates to must be auto selecting YES and once appended it then can't save because its read only.

    Many thanks
    Kevin
    Regards
    Gerbil (AKA Kevin)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove read only attribute (2003)

    There's no really good way to do that in VBA - see Open Read Only Recommended documents

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •