Vba - Removing workbook

  • Thread starter Thread starter ajliaks
  • Start date Start date
A

ajliaks

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top