Kill Function by author
This function can get the uthor property of an open workbook, which you can
then use the path of to kill
'-----------------------------------------------------------------
Function DocProps(prop As String)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function
use as
If DocProps("author") = "me" Then
Kill Activeworkbook.Fullname
ActiveWorkbook.Close SaveChanges:=False
End If
--
__________________________________
HTH
Bob
"Gordon" wrote in message
...
Hi.
I'm handing back my laptop to a company having worked on secondment for
them
for a year. In this time I've created hundreds of excel files that sit
mingled with 100's from the company. They have no designated home and sit
randomly across the hard drive. Basically, I want to delete all of the
files
that I created and leave the files behind that are generic to the company.
I
know the kill function can work on set locations, but is there a way to
delete files based on the value in the author/properties field? sounds
tricky.
THanks in advance of a seriously clever answer!
GC
|