Solved

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

Posted on 2004-09-22
6
134 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

23 Experts available now in Live!

Get 1:1 Help Now