Connecting Tech Pros Worldwide Help | Site Map

Kill hidden files

dixie
Guest
 
Posts: n/a
#1: Nov 13 '05
I am trying to delete the temporary files that MS Word leaves behind
sometimes when it fails to clean up properly. Files like ~$lename.dot. I
have used the Kill command, but find that this doesn't work for hidden files
like these. If I change their attributes it works perfectly. Is there a
command that can kill hidden files too? If not, how can I get around this
as this problem prevents some mailmerge templates from operating by
automation because the last time they were used, Word did not delete the
hidden file. I am using VBA to do this as I want to run the command off a
button. I am picking up the path from a DLookup as it varies from site to
site.

Function KillTempFiles()
If Dir(DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot") > "" Then
Kill (DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot")
End If
On Error Resume Next
End Function

dixie


John Mishefske
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Kill hidden files


dixie wrote:
[color=blue]
> Is there a
> command that can kill hidden files too? If not, how can I get around this
> as this problem prevents some mailmerge templates from operating by
> automation because the last time they were used, Word did not delete the
> hidden file. I am using VBA to do this as I want to run the command off a
> button. I am picking up the path from a DLookup as it varies from site to
> site.
>
> Function KillTempFiles()
> If Dir(DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot") > "" Then
> Kill (DLookup("[Path]", "tblMailmerge", "mID=1") & "~*.dot")
> End If
> On Error Resume Next
> End Function[/color]

The Dir() function takes a 2nd parameter where you can specify hidden files
if you want (with vbHidden).

There is also the SetAttr and GetAttr commands that you can use to set or
get file attributes.

--
'-------------------------------
' John Mishefske
'-------------------------------

Closed Thread