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

Hi all,

I am trying to remove a specific Workbook using code.

I am trying this, but getting error!

Ruta = Left(ActiveWorkbook.Path, _
Len(ActiveWorkbook.Path) - Val(ActiveWorkbook.Name))

Ruta = Ruta & "\" & ToolToErase

Workbooks.Delete Filename:=Rut

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Vba - Removing workbook

There is no Delete method of the Workbooks collection. Instead,
just close the workbook.


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


"ajliaks " wrote in
message ...
Hi all,

I am trying to remove a specific Workbook using code.

I am trying this, but getting error!

Ruta = Left(ActiveWorkbook.Path, _
Len(ActiveWorkbook.Path) - Val(ActiveWorkbook.Name))

Ruta = Ruta & "\" & ToolToErase

Workbooks.Delete Filename:=Ruta


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Vba - Removing workbook

Try the following (must be in another file; untested)

dim wB as string
wB = activeworkbook.fullpath
activeworkbook.close false
Kill wB

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"ajliaks " wrote in message
...
Hi all,

I am trying to remove a specific Workbook using code.

I am trying this, but getting error!

Ruta = Left(ActiveWorkbook.Path, _
Len(ActiveWorkbook.Path) - Val(ActiveWorkbook.Name))

Ruta = Ruta & "\" & ToolToErase

Workbooks.Delete Filename:=Ruta


---
Message posted from http://www.ExcelForum.com/



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
removing a macro from a workbook Roger Excel Worksheet Functions 2 December 22nd 06 08:30 PM
Problem removing hyperlinks in workbook Tai-Pan Excel Discussion (Misc queries) 5 October 21st 05 11:32 PM
Removing macros from workbook Darrell Excel Discussion (Misc queries) 1 October 4th 05 03:56 AM
Removing link to another workbook ATC Excel Discussion (Misc queries) 2 June 30th 05 12:48 AM
Removing links to other worksheets from within a workbook rjb Excel Discussion (Misc queries) 2 December 9th 04 08:04 AM


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

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

About Us

"It's about Microsoft Excel"