Solved

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

Posted on 2004-09-22
6
135 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now