excel 2003 visual basic intermediate course - deleting file
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and Help » excel 2003 visual basic intermediate course - Deleting a file

excel 2003 visual basic intermediate course - Deleting a file

The UK's most regular instructor-led training courses.
Training information: excel 2003 visual basic intermediate course · Excel courses london · VBA training UK

resolvedResolved · Low Priority · Version Standard

Deleting a file

Samantha has attended:
Excel VBA course

by - delegate Samantha [21 posts] (2007 Nov 26 Mon, 11:51) replyReply

can you please tell me how i can delete a file from within excel vba?

the file is a .csv file or a .cap file (this is just a file with a .cap extension and is in effect a text file). After i do all the formatting on the file and paste it into another worksheet, i need to then clear down this file by deleting it.

can anyone please tell me how?

thanks
sam

Excel Advanced 1 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2003 2008 Aug 29 Fri Southwark 3 book now £224 £235
2003 2008 Sep 3 Wed Bloomsbury 5 book now £219 £235
2003 2008 Sep 5 Fri Bayswater 4 book now £195 £205
2002/XP 2008 Sep 10 Wed Tooting 0 FULL    
2003 2008 Sep 10 Wed Bloomsbury 5 book now £219 £235
2003 2008 Sep 12 Fri Southwark 7 book now £203 £230
Full Schedule: See all 127 Excel Advanced course dates.
Bookings currently available until 24th November 2009.

RE: deleting a file

by - trainer Carlos gold contributer[394 posts] (2007 Nov 26 Mon, 14:43) Edited on 2007 Nov 26 Mon, 14:44 replyReply

Hi Samantha

To delete a file from the system you need to know the name of the file to be deleted. then you instruct the system to Kill the file.

NB This permanently deletes the file from the hard drive. It doesn't put it in the Recycle bin.

The code is as follows as a example

Sub DeleteAFile()

Dim WbString As String

WbString = "C:\Documents and Settings\User6\My Documents\My Sheets.csv" 'The path of the file to be deleted

Kill WbString

End Sub


Hope this helps

Carlos

RE: deleting a file

by - delegate Samantha [21 posts] (2007 Nov 26 Mon, 14:52) replyReply

thanks for this carlos.. another question answered!!
sam


Related articles

· Microsoft Excel's Best Kept Secret
· Identifying Suitable Candidates For VBA For Excel Training
· Features of Microsoft Excel that assist in Analysis of Financial Data
· Microsoft Excel Training - Numerical excellence for all
· Microsoft Excel Training Course

Excel tip:

Checking if a calculation adheres to Order of Precedence

When writing formulas you must make sure that results will be calculated as you intended.

Excel adheres to the standard order of precedence for calculations. It calculates percentages, exponents, multiplication, and division in this order before calculating addition and subtraction.

For example, =7+5*3 results in an answer of 22, not 36.

To force a calculation to be completed before another calculations, place the section in parentheses: =(7+5)*3 will result in 36.

To check how excel is evaluating a formula, click on the cell and select the 'Tools' menu, select 'Formula Auditing' and click 'Evaluate Formula'

In the dialog box click on 'Evaluate' to watch as each part of the formula is successively calculated.

View all Excel hints and tips

Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information
AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz