Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Deleting a workbook from Disk

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Deleting a workbook from Disk

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Deleting a workbook from Disk

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Deleting a workbook from Disk



"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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save a file to disk without re-formating the disk Frustrated Mike Excel Discussion (Misc queries) 2 February 19th 09 07:33 PM
deleting workbook saqib New Users to Excel 1 June 24th 08 03:22 PM
I get a "Disk full" message,what disk? Deputydog New Users to Excel 4 April 10th 08 08:42 PM
Any Tricks to decreasing Workbook size (disk space usage)? Bruce Excel Discussion (Misc queries) 3 August 16th 05 02:20 PM
Download files from 3.5 disk in excel but system said disk need fo DG Excel Discussion (Misc queries) 0 August 13th 05 04:16 PM


All times are GMT +1. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"