Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to make a little button that, wehn pressed, would delete
all files in a directory except for the ones that I specidy. It would be nice if I could display a listbox and check the ones that I wanted to delete but for now, I can just hardcode the files to keep. I can populate the listbox but can't figure out how to delete the ones not selected. Anyone have any ideas on how to do this? Thanks in advance, David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
David,
It would be nice if I could display a listbox and check the ones that I wanted to delete Here's a macro that will delete the files that you choose: Sub DeleteMultipleUserSelectedFiles() Dim FileArray As Variant Dim i As Integer FileArray = Application.GetOpenFilename(MultiSelect:=True) If IsArray(FileArray) Then For i = LBound(FileArray) To UBound(FileArray) Kill FileArray(i) Next i End If End Sub HTH, Bernie MS Excel MVP "David Johnston" wrote in message oups.com... I would like to make a little button that, wehn pressed, would delete all files in a directory except for the ones that I specidy. It would be nice if I could display a listbox and check the ones that I wanted to delete but for now, I can just hardcode the files to keep. I can populate the listbox but can't figure out how to delete the ones not selected. Anyone have any ideas on how to do this? Thanks in advance, David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to delete archived files | Excel Discussion (Misc queries) | |||
How to delete archived tmp files | Excel Discussion (Misc queries) | |||
Delete files with VBA | Excel Programming | |||
Delete Files with less than 2 sheets | Excel Programming | |||
Delete All Files in a folder | Excel Programming |