ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Kill file (https://www.excelbanter.com/excel-programming/370614-kill-file.html)

ew

Kill file
 
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance



Die_Another_Day

Kill file
 
Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the error messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance



Die_Another_Day

Kill file
 
Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the warning messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance



ew

Kill file
 
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"

"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the error messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance




ew

Kill file
 
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"



"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the warning messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance




[email protected]

Kill file
 
Hi,

Just makse sure you're using the match application version ...!
in XL 2003 is supported, but don;t know in the earlier ....

Thanks,
halim

EW menuliskan:
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"

"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the error messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance





ew

Kill file
 
yeah sorry, I'm using XL 2000

" wrote:

Hi,

Just makse sure you're using the match application version ...!
in XL 2003 is supported, but don;t know in the earlier ....

Thanks,
halim

EW menuliskan:
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"

"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the error messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro. The
files are all named something different but the extentions are all the same
(.tvr). Here's the path: C:\program files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance





Tom Ogilvy

Kill file
 
how about just

Kill "C:\program files\ccapps\ttlview\WORK\Reports\*.tvr"


--
Regards,
Tom Ogilvy


"EW" wrote in message
...
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"



"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the warning messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro.
The
files are all named something different but the extentions are all the
same
(.tvr). Here's the path: C:\program
files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance






ew

Kill file
 
That worked perfectly! I just need to have our cheap company upgrade its
office products!

"Tom Ogilvy" wrote:

how about just

Kill "C:\program files\ccapps\ttlview\WORK\Reports\*.tvr"


--
Regards,
Tom Ogilvy


"EW" wrote in message
...
I got the following error at the part:

With Application.FileDialog(msoFileDialogFilePicker)

"Object doesn't support this property or method"



"Die_Another_Day" wrote:

Sub KillTvrFiles()
Dim cnt As Long
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "C:\program files\ccapps\ttlview\WORK\Reports\"
.Filters.Clear
.Filters.Add "tvr Files", "*.tvr"
.Title = "Please Select Files to be deleted"
If .Show = False Then Exit Sub
If MsgBox("Are you sure you want to delete all selected files?", _
vbYesNo, "Warning! Deleting Files") = vbNo Then Exit Sub
For cnt = 1 To .SelectedItems.Count
Kill .SelectedItems(cnt)
Next
End With
End Sub

Charles

P.S. Let me know if you want code to kill all .tvr files in that folder
and if you need help killng the warning messages.

EW wrote:
All--
I have a group of files that need to be deleted before running a macro.
The
files are all named something different but the extentions are all the
same
(.tvr). Here's the path: C:\program
files\ccapps\ttlview\WORK\Reports\

Any help would be great!

Thanks in advance







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

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