Last night I made a program which deletes a file, I used kill and it worked. Today it keeps saying permission denied! I have tryed deleting the file and making a new one, I have changed from kill to fso.deletefile and it always says 'permission denied'.
i told you that I have tryed using kill and fso and I have tryed getting code off the net and everytime the error still pops up! Also it worked the day before!
I have just done a bit of testing and the program works if the file extension is '.txt' but not if the extension is anything else. I want the extension to be '.sto' and it used to work but now it won't let me delete anything unless it has the text extension!
is the program being used by a different user (with different permissions on folders).
Is the users folder on the network.
Could someone else have changed the permissions on the folder.
Are you the only person using this program. Does anyoneelse access you machine ?
Have you recompiled the exe ?
Things don't just stop working. Something else has changed.
And it's not the antivirus.
Something (regardless of what you think) has changed.
Either the application is no longer in the same location or
access permissions (domain user, network share,......) are stopping the program deleting.
no its the same user doing it.
nobody else changed the permissions (and I have checked anyway)
nobody has changed the permissions or anything else relating to the program.
i have tryed compiling the exe and just running from vb
Are you accessing the file somewhere else in the program first? It seems to be related to the program since you can manually delete it without permission denied problem.
Well, let's use windows to delete the file instead of VB then. Here's a win API you can call.
Declare Function DeleteFile Lib "kernel32.dll" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
' Delete the file
Dim lReturnVal As Long ' return value, just for debugging purpose
Dim strUserFile as string
strUserFile = "users\" & strLoggedOn & ".sto"
lReturnVal = DeleteFile(strUserFile)
If lReturnVal = 1 Then Debug.Print "File deleted successfully."