
Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
That's probably overkill. VBA includes the SetAttr statement that will let
you change the attributes of a file.
To remove a file's Read-only attribute, while leaving the other attributes
the same, you can use:
SetAttr "full path to file", (GetAttr("full path to file") - vbReadOnly)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Hi,
> here a sample API to change file attributes:
[quoted text clipped - 11 lines]
>>
>> If (fso.FileExists(destnewsfile)) then fso.deletefile (destnewsfile)
Alex Dybenko - 30 Nov 2006 13:57 GMT
Hi Doug,
yes, you are right, forgot about native SetAttr
But Wendy also uses fso.deletefile instead of VBA's Kill :-)

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> That's probably overkill. VBA includes the SetAttr statement that will let
> you change the attributes of a file.
[quoted text clipped - 21 lines]
>>>
>>> If (fso.FileExists(destnewsfile)) then fso.deletefile (destnewsfile)
Douglas J. Steele - 30 Nov 2006 14:29 GMT
Yup.
No need for FSO at all, is there? <g>
Dim intAttribute As Integer
If Len(Dir(destnewsfile)) > 0 Then
intAttribute = GetAttr(destnewfile)
If (intAttribute And vbReadOnly) <> 0 Then
SetAttr destnewfile, (intAttribute - vbReadOnly)
End If
Kill destnewsfile
End If

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Hi Doug,
> yes, you are right, forgot about native SetAttr
[quoted text clipped - 25 lines]
>>>>
>>>> If (fso.FileExists(destnewsfile)) then fso.deletefile (destnewsfile)
Tim Ferguson - 30 Nov 2006 16:40 GMT
> That's probably overkill. VBA includes the SetAttr statement that will
> let you change the attributes of a file.
[quoted text clipped - 4 lines]
> SetAttr "full path to file", (GetAttr("full path to file") -
> vbReadOnly)
That's probably overkill too. My help file says that the .Delete method of
the File object has a Force parameter that will kill readonly files...
Set fil = fso.GetFile(somePathString)
fil.Delete True
Hope that helps
Tim F
Douglas J. Steele - 30 Nov 2006 17:01 GMT
>> That's probably overkill. VBA includes the SetAttr statement that will
>> let you change the attributes of a file.
[quoted text clipped - 10 lines]
> Set fil = fso.GetFile(somePathString)
> fil.Delete True
You're right, but I don't like using FSO when it's not necessary!
Being picky, Wendy could simply use:
If (fso.FileExists(destnewsfile)) then fso.deletefile destnewsfile, True

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)