1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: VBA to delete FILE

Discussion in 'Business Applications' started by tomlock2, Dec 5, 2011.

Thread Status:
Not open for further replies.
  1. tomlock2

    tomlock2 Thread Starter

    Nov 20, 2011
    I'm using Windows 7 and Access 2010. I want to delete all *.PDF files in a certain folder using a VBA command within ACCESS. I have tried all kinds of formats with the KILL statement unsuccessfully. Any help deeply appreciated.

    I've tried ---

    KILL ("C:\pathname\*.PDF")
    KILL "C:\pathname\*.PDF"

    I've tried it with many other variations. I've even tried it with an explicit filename and the file exists before executing the command.

    In all cases the code errors out.
  2. Rockn


    Jul 29, 2001
    Create a button and put this in the onClick event

    Kill "C:\whatever\*.pdf"

    Once the files are gone they cannot be retrieved from the recycle bin.
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1029858

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice