Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Kill statement problems

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Kill statement problems

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Kill statement problems

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Kill statement problems

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
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
Problems with IF statement Bell Excel Worksheet Functions 3 September 21st 06 09:37 PM
On time kill Antonio Excel Discussion (Misc queries) 4 June 8th 06 10:50 AM
Problems with IF statement terry_d Excel Worksheet Functions 4 April 5th 06 06:50 PM
Problems with an IF statement Amaloney Excel Worksheet Functions 3 September 15th 05 05:52 PM
AutoFill KILL Frustrated[_2_] Excel Programming 1 July 29th 03 04:40 PM


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