View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Hank Scorpio Hank Scorpio is offline
external usenet poster
 
Posts: 103
Default kill command and excel

On Sat, 29 Aug 2009 17:35:01 -0700, charles
wrote:

I would like to use the Kill command to delete a file whose name and location
have been selected in a drop down box.

ie the drop down box named "filetodestroy" has the following selected
C:programs/mycrap/test.xls

what syntax do u use to make the kill command destroy the file selected?


It's just
Kill pathname

but at a guess your problem is that it should be
C:\programs\mycrap\test.xls

(That is, you're missing the first slash after the drive. Generally
the path will use backslashes rather than forward slashes as well,
though either will work with Kill.)

You may also want to use
On Error Resume Next
before the command and
On Error GoTo 0
after it to temporarily turn off error handling. That way if the file
isn't there, you won't be bugged with an error message.