Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

HOW DO I DELETE A BMP FILE IN MY HARD DRIVE.

Hi,

I would like to delete a specific bmp file on a specific directory. how do I do that? Thanks.
0
neonlights
Asked:
neonlights
5 Solutions
 
fds_fatboyCommented:
kill (pathname)
0
 
Erick37Commented:
On Error Resume Next  ' or GoTo ...
Kill "c:\thepath\thebmp.bmp"
0
 
fds_fatboyCommented:
sorry - try again

kill pathname
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
EDDYKTCommented:
You may get an error if file is readonly


SetAttr pathname, GetAttr(pathname) And Not vbReadOnly
Kill pathname
0
 
TeddyZeroCommented:
Try this

Sub DeleteAFile(ByVal filespec As String)
   Dim fso As Object
   Set fso = CreateObject("Scripting.FileSystemObject")
   fso.DeleteFile(filespec)
End Sub


I Hope this helps you...
:-)
0
 
sgayatriCommented:
Add project >> references >> microsoft scripting runtime to yur project

dim fso as new scripting.filesystemobject
 str1="yourfilewithpath"

if fso.fileexists(str1) then   ''check if ur file exists
   fso.deletefile(str1)
end if
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now