Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When I run this code;
Sub Newe() ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ("The File.xls") .SendMail ", Subject:= _ "Your file" Kill .FullName .Close False End With End Sub I am getting an error message that says: Run-Time error '75': Path/File access error The debugger highlights the Kill .FullName line of my code. What's wrong with this -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using the Kill command that way, you are trying to delete a workboo
that is open. Which is not possible. You'll need to close it first, then delete it which can be achieve using the following code which stores the file path into variable 'x and changes two of your lines of code around to close it first, the deletes the file indicated by 'x'. Sub Newe() ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs ("The File.xls") .SendMail ", Subject:= _ "Your file" x = .FullName .Close False Kill x End With End Sub Regards, Boici -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Boicie,
you are trying to delete a workbook that is open. Which is not possible. Nothing is impossible. From a previous post by Chip Pearson: With ThisWorkbook .Saved = True .ChangeFileAccess xlReadOnly Kill.FullName .Close savechanges:=False End With John "Boicie " wrote in message ... Using the Kill command that way, you are trying to delete a workbook that is open. Which is not possible. You'll need to close it first, then delete it which can be achieved using the following code which stores the file path into variable 'x' and changes two of your lines of code around to close it first, then deletes the file indicated by 'x'. Sub Newe() ActiveSheet.Copy Set wb = ActiveWorkbook With wb SaveAs ("The File.xls") SendMail ", Subject:= _ "Your file" x = .FullName Close False Kill x End With End Sub Regards, Boicie --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You must change it to read only See this example http://www.rondebruin.nl/sendmail.htm#Sheet -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Marino13 " wrote in message ... When I run this code; Sub Newe() ActiveSheet.Copy Set wb = ActiveWorkbook With wb SaveAs ("The File.xls") SendMail ", Subject:= _ "Your file" Kill .FullName Close False End With End Sub I am getting an error message that says: Run-Time error '75': Path/File access error The debugger highlights the Kill .FullName line of my code. What's wrong with this? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problems with IF statement | Excel Worksheet Functions | |||
On time kill | Excel Discussion (Misc queries) | |||
Problems with IF statement | Excel Worksheet Functions | |||
Problems with an IF statement | Excel Worksheet Functions | |||
AutoFill KILL | Excel Programming |