LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default save and delete a file when in it with code

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

 
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
Trying to delete blank rows after file save pm Excel Discussion (Misc queries) 2 April 15th 10 11:58 PM
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
rename current file save and delete original valve79 Excel Programming 0 January 13th 06 09:17 PM
code to delete a file Pradip Jain Excel Programming 3 April 29th 05 05:43 AM
how to delete all macros - save file with cell-name Tom Excel Programming 8 June 23rd 04 11:30 AM


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