Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to be able to kill a file once I have saved a copy of it to it's new
location. I can save a copy from within the file and I can kill it from my desktop (executing the same code) . When I go to kill from within the folder I get a Permission Denied (Error 70) appearing. I am the owner / creator of the folders and have full control of them. I can delete anything with mouse clicks but not with code from within the folder. The code I am using is as follows: Sub DeletethenSaveFile() Folderdetails = " Filepath and Name" ThisWorkbook.SaveCopyAs "New Filepath and Name" MsgBox "Your file has been saved to it's new location" On Error Resume Next Kill Folderdetails '"Filepath and Name" MsgBox "The requested file has been deleted" MsgBox "This file will now close" ThisWorkbook.Close SaveChanges = False End Sub Please help me!!! D |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Damien
You can kill a open file by changing the ChangeFileAccess See how I do it here http://www.rondebruin.nl/mail/folder1/mail2.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Damien" wrote in message ... I need to be able to kill a file once I have saved a copy of it to it's new location. I can save a copy from within the file and I can kill it from my desktop (executing the same code) . When I go to kill from within the folder I get a Permission Denied (Error 70) appearing. I am the owner / creator of the folders and have full control of them. I can delete anything with mouse clicks but not with code from within the folder. The code I am using is as follows: Sub DeletethenSaveFile() Folderdetails = " Filepath and Name" ThisWorkbook.SaveCopyAs "New Filepath and Name" MsgBox "Your file has been saved to it's new location" On Error Resume Next Kill Folderdetails '"Filepath and Name" MsgBox "The requested file has been deleted" MsgBox "This file will now close" ThisWorkbook.Close SaveChanges = False End Sub Please help me!!! D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to delete blank rows after file save | Excel Discussion (Misc queries) | |||
2007 Macro to Open File, Delete Contents, Save New File | Excel Discussion (Misc queries) | |||
rename current file save and delete original | Excel Programming | |||
code to delete a file | Excel Programming | |||
how to delete all macros - save file with cell-name | Excel Programming |