Chad,
Please be warned that I knew nothing about this API before reading this, and
not that much about API's in general. But if I change one section as
follows, it does work:
With CFileStruct
..hwnd = Application.hwnd
..fFlags = FOF_ALLOWUNDO
..pFrom = FileName
..wFunc = FO_DELETE
End With
Note the dots at the begin of each line between With and End With. For some
reason they don't show in Crowbar's original post of the code, but they do
below in this one, weird. I replaced "Me' with "Application". That
"attaches" the recycle prompt form to Excel, i.e., if you go to another
program and then come back to Excel, the Recycle prompt will still be there.
I think Crowbar used "Me" because he was running this code from a VB
program, not Excel.
One other thing, if you are testing this on an Excel Userform, the click
event would be for "CommandButton1" not "Command1" as it is in VB, which
Crowbar is using.
hth,
Doug