Solved

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

Posted on 2004-09-22
6
137 Views
Last Modified: 2010-05-02
Hi,

I would like to delete a specific bmp file on a specific directory. how do I do that? Thanks.
0
Comment
Question by:neonlights
6 Comments
 
LVL 10

Expert Comment

by:fds_fatboy
ID: 12124497
kill (pathname)
0
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 50 total points
ID: 12124499
On Error Resume Next  ' or GoTo ...
Kill "c:\thepath\thebmp.bmp"
0
 
LVL 10

Assisted Solution

by:fds_fatboy
fds_fatboy earned 50 total points
ID: 12124505
sorry - try again

kill pathname
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 50 total points
ID: 12125796
You may get an error if file is readonly


SetAttr pathname, GetAttr(pathname) And Not vbReadOnly
Kill pathname
0
 
LVL 2

Assisted Solution

by:TeddyZero
TeddyZero earned 50 total points
ID: 12126017
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
 
LVL 3

Accepted Solution

by:
sgayatri earned 50 total points
ID: 12131062
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question