VBA Delete files

Deleting files on your drive with VBA is relatively easy. The ‘kill’ command is used but be careful, as the file is not sent to the Recycle Bin, it’s deleted forever.

This example code will delete the file named datanology.xls in My Documents but you can change as you require, add it into a loop to delete many files etc.


Kill “C:\Users\Datanology\My Documents\Datanology.xls


Leave us a message below or contact us for help and guidance on your Excel project.


Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology

Leave a Reply

Your email address will not be published. Required fields are marked *