+ Reply to Thread
Results 1 to 7 of 7

Macro to rename and move files

  1. #1
    Registered User
    Join Date
    07-13-2007
    Posts
    4

    Macro to rename and move files

    Hi all wise Excel gurus,

    I am in desperate need of a macro that can do the following :

    1. Find a file in a certain folder by a few letters, ie "002" in a file called "Fordprocs002.txt"

    2. Then move that file from C:\test to c:\tested and rename it to "O2009.txt"


    Additionally it would be great if its possible to get that file into a new message in Lotus as attachment and with 4 addresses in BCC and Subject "Results"

    I have searched so much to find this out, and cant seem to get it right, as Im not too skilled with scripts. So any copy paste material would be a lifesaver here..

    Caroline

  2. #2
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    Here is a function that I use to search a folder

    Please Login or Register  to view this content.
    Here is a routine for creating a backup file

    Please Login or Register  to view this content.
    Last edited by Tarball; 07-13-2007 at 01:49 PM.

  3. #3
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    Here is a link to a post with a routine for the email http://www.excelforum.com/showthread.php?t=601096

  4. #4
    Registered User
    Join Date
    07-13-2007
    Posts
    4
    Great, tnx alot for your help guys. Will try it tonight, and post results

    Have a nice saturday all.

  5. #5
    Registered User
    Join Date
    07-13-2007
    Posts
    4
    Hi, I got this error message : Object doesn't support this action (Error 445)
    when I ran macro for renaming files. What am I doing wrong? Pasted it in as above.

    Caroline

  6. #6
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    I use Excel 2003; not sure if earlier versions of Excel support the scripting library. In any event, make sure that you have a reference checked to the scripting library.

    Please post your code.

  7. #7
    Registered User
    Join Date
    07-13-2007
    Posts
    4
    Think problem is that Im messing around in Excel 2007 now, will try at work tomorrow in excel 2003.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1