Solved

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

Posted on 2004-09-22
6
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 
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

Independent Software Vendors: 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!

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

739 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