Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    81

    Unanswered: Rename .txt files

    I want to rename a non-Access .txt file in a specific directory using Access vba. Is this possible?

    Thanks,

    Bjorn

  2. #2
    Join Date
    Mar 2004
    Location
    Oakland, CA, USA
    Posts
    26
    Yes, That is possible. Using Name. Ex:

    Name Oldfile As Newfile

  3. #3
    Join Date
    Jan 2003
    Posts
    81
    Thanks! That works great. Except if Newfile already exists. So how to delete it first??

    Bjorn

  4. #4
    Join Date
    Mar 2004
    Location
    Oakland, CA, USA
    Posts
    26
    In that case use Dir function to search for the filename. Try this:

    If Dir(Newfile) <> "" Then
    Kill Newfile '!!
    Name Oldfile As Newfile
    Else
    Name Oldfile As Newfile
    End If
    Last edited by McCampbell; 11-09-04 at 16:43.

  5. #5
    Join Date
    Jan 2003
    Posts
    81
    Works great. Thanks!
    Bjorn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •