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

Is it possible to delete a workbook through a macro? Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Delete a workbook

A workbook is the same as the file, so you'd first close the
workbook, then Kill the file. E.g.,

Workbooks("TheBook.xls").Close SaveChanges:=False
Kill "TheBook.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"sharman" wrote in message
...
Is it possible to delete a workbook through a macro? Thanks in
advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Delete a workbook

Thanks a lot for the quick response. Please let me know if there is a way of

a. renaming the files
b. saving the files with a different name in a particular folder

by using a macro. Thanks again.


"Chip Pearson" wrote:

A workbook is the same as the file, so you'd first close the
workbook, then Kill the file. E.g.,

Workbooks("TheBook.xls").Close SaveChanges:=False
Kill "TheBook.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"sharman" wrote in message
...
Is it possible to delete a workbook through a macro? Thanks in
advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Delete a workbook

a. Look up Name in VBA's help
b. Look up SaveAs in VBA's help.



sharman wrote:

Thanks a lot for the quick response. Please let me know if there is a way of

a. renaming the files
b. saving the files with a different name in a particular folder

by using a macro. Thanks again.

"Chip Pearson" wrote:

A workbook is the same as the file, so you'd first close the
workbook, then Kill the file. E.g.,

Workbooks("TheBook.xls").Close SaveChanges:=False
Kill "TheBook.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"sharman" wrote in message
...
Is it possible to delete a workbook through a macro? Thanks in
advance





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Delete a workbook

Thanks for the reply. I looked up as per your suggestion and it helped. I
want to know if it's possible to activate/close an open workbook by using a
part name alongwith with a wild character? Like if the workbook name is
"OLD_6_10" and I want to activate it by just using "OLD*". I tried to use
but I get an error message. Thanks in advance.

"Dave Peterson" wrote:

a. Look up Name in VBA's help
b. Look up SaveAs in VBA's help.



sharman wrote:

Thanks a lot for the quick response. Please let me know if there is a way of

a. renaming the files
b. saving the files with a different name in a particular folder

by using a macro. Thanks again.

"Chip Pearson" wrote:

A workbook is the same as the file, so you'd first close the
workbook, then Kill the file. E.g.,

Workbooks("TheBook.xls").Close SaveChanges:=False
Kill "TheBook.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"sharman" wrote in message
...
Is it possible to delete a workbook through a macro? Thanks in
advance




--

Dave Peterson



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
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
how do you delete a workbook Bob Excel Discussion (Misc queries) 2 October 3rd 05 12:18 AM
how do I delete a worksheet from my workbook DLee New Users to Excel 2 August 15th 05 09:59 PM
How do I delete a workbook after the vba has run? Patrick Excel Programming 1 January 28th 05 04:17 PM
how do I delete a workbook tubby55 Excel Programming 2 August 28th 04 08:03 AM


All times are GMT +1. The time now is 07:32 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"