PDA

View Full Version : Solved: Kill permision denied



charmer
04-10-2006, 06:41 AM
Hi
i am trying to save an attachment for temproray use and then delete it afterwards and i keep getting premission denied error when i want to delete the attachment :/

For Each eItem In Inbox.Items
If eItem.UnRead = True Then
For Each atmt In eItem.Attachments
If Right(atmt.FileName, 3) = "xml" Then


atmtP = "C:\" & atmt.FileName

atmt.SaveAsFile atmtP
'NOW WHEN I TRY TO DO THIS FOR EXAMPLE
kill atmtP ' i get premision denied error


i think once i use SaveAsFile the file is opened and i can't seem to find a way to close it because i can't seem to be able to delete the file even manually unless i close outlook
any help would be great thanks...

Post edited 12-Apr-06 by GeekGirlau. Reason: insert vba tags

charmer
04-10-2006, 07:34 PM
problem solved!,

I found out that when i get the attachment file i keep a reference to it, so when i tried to delete it i couldn't do that >_>. thx all anywayz

geekgirlau
04-11-2006, 06:27 PM
Hi Charmer,

I'm glad you were able to solve this so quickly!

Just for future reference, please use the vba tags when posting code as it makes it easier to read - select the code, then click on the VBA button.

I've marked this thread as "Solved" for you - normally you can do this yourself via the Thread Tools option at the top of the page, however it's not working at the moment. If you want to mark a thread as solved, post a message to that effect and one of the Moderators will do it for you.

And welcome to the board :006: