Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good morning, all,
Nice easy one for you all. Is it possible to delete a workbook from a disk using VBA? I tried to record myself doing it, with File Open, right clicking a workbook, then clicking "Delete", but all I got was a CHDir Command. Thanks in advance pete |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use the Kill statement to do this:
Kill "C:\myfolder\myfile.xls" This will throw an error if the file doesn't exist, or if it can't be deleted for some reason (e.g. read-only or in use), so you might want to put in some error-handling. Andrew Taylor Peter Rooney wrote: Good morning, all, Nice easy one for you all. Is it possible to delete a workbook from a disk using VBA? I tried to record myself doing it, with File Open, right clicking a workbook, then clicking "Delete", but all I got was a CHDir Command. Thanks in advance pete |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Andrew,
Just the job. Thank you! Pete "Andrew Taylor" wrote: You can use the Kill statement to do this: Kill "C:\myfolder\myfile.xls" This will throw an error if the file doesn't exist, or if it can't be deleted for some reason (e.g. read-only or in use), so you might want to put in some error-handling. Andrew Taylor Peter Rooney wrote: Good morning, all, Nice easy one for you all. Is it possible to delete a workbook from a disk using VBA? I tried to record myself doing it, with File Open, right clicking a workbook, then clicking "Delete", but all I got was a CHDir Command. Thanks in advance pete |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Peter Rooney" wrote: Good morning, all, Nice easy one for you all. Is it possible to delete a workbook from a disk using VBA? I tried to record myself doing it, with File Open, right clicking a workbook, then clicking "Delete", but all I got was a CHDir Command. Thanks in advance pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save a file to disk without re-formating the disk | Excel Discussion (Misc queries) | |||
deleting workbook | New Users to Excel | |||
I get a "Disk full" message,what disk? | New Users to Excel | |||
Any Tricks to decreasing Workbook size (disk space usage)? | Excel Discussion (Misc queries) | |||
Download files from 3.5 disk in excel but system said disk need fo | Excel Discussion (Misc queries) |