ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Kill command using & (https://www.excelbanter.com/excel-programming/352098-kill-command-using.html)

PCLIVE

Kill command using &
 
The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul



Ron de Bruin

Kill command using &
 
Have you try it ?
Answer is No

If you want to delete all files in a folder you can do this

On Error Resume Next
Kill "C:\folder\*.*"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message ...
The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul




Charlie

Kill command using &
 
No, that would append the two filename strings into one. It would be the
same as doing

Kill "C:\File1.txtC:\File2.txt"

"PCLIVE" wrote:

The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul




PCLIVE

Kill command using &
 
Ok Ron,

Here's what I got. I need to kill one or two files based on an if
statement. If L2 = "Jan", then I need to delete FileNameZip3. Else I need
to delete two files, FileNameZip2 and FileNameZip3. How would I do this?
If there is such thing as a block Else statement...

If Sheets("Setup").Range("L2").Value = "Jan" _
Then Kill FileNameZip3 _
Else Kill FileNameZip2
Kill FileNameZip3

Thanks,
Paul

"Ron de Bruin" wrote in message
...
Have you try it ?
Answer is No

If you want to delete all files in a folder you can do this

On Error Resume Next
Kill "C:\folder\*.*"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message
...
The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul






Ron de Bruin

Kill command using &
 
Try this

If Sheets("Setup").Range("L2").Value = "Jan" Then
Kill FileNameZip3
Else
Kill FileNameZip2
Kill FileNameZip3
End If


--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message ...
Ok Ron,

Here's what I got. I need to kill one or two files based on an if statement. If L2 = "Jan", then I need to delete FileNameZip3.
Else I need to delete two files, FileNameZip2 and FileNameZip3. How would I do this? If there is such thing as a block Else
statement...

If Sheets("Setup").Range("L2").Value = "Jan" _
Then Kill FileNameZip3 _
Else Kill FileNameZip2
Kill FileNameZip3

Thanks,
Paul

"Ron de Bruin" wrote in message ...
Have you try it ?
Answer is No

If you want to delete all files in a folder you can do this

On Error Resume Next
Kill "C:\folder\*.*"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message ...
The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul








PCLIVE

Kill command using &
 
That's it. Pretty simple, but my brain wasn't functioning.

Thanks for the help.
Paul

"Ron de Bruin" wrote in message
...
Try this

If Sheets("Setup").Range("L2").Value = "Jan" Then
Kill FileNameZip3
Else
Kill FileNameZip2
Kill FileNameZip3
End If


--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message
...
Ok Ron,

Here's what I got. I need to kill one or two files based on an if
statement. If L2 = "Jan", then I need to delete FileNameZip3. Else I
need to delete two files, FileNameZip2 and FileNameZip3. How would I do
this? If there is such thing as a block Else statement...

If Sheets("Setup").Range("L2").Value = "Jan" _
Then Kill FileNameZip3 _
Else Kill FileNameZip2
Kill FileNameZip3

Thanks,
Paul

"Ron de Bruin" wrote in message
...
Have you try it ?
Answer is No

If you want to delete all files in a folder you can do this

On Error Resume Next
Kill "C:\folder\*.*"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"PCLIVE" wrote in message
...
The following code works fine.

Kill FileNameZip2
Kill FileNameZip3


Would the following code do the same?

Kill FileNameZip2 & FileNameZip3

Thanks,
Paul











All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com