+ Reply to Thread
Results 1 to 5 of 5

Macro That Creates Text Doc in specific folder based on cell value

  1. #1
    Registered User
    Join Date
    08-26-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Macro That Creates Text Doc in specific folder based on cell value

    I need to create a macro that will look at a specific cell, and if it is filled, create a txt document with that cell name, in a specific folder.

    For example, if A1 = "John Smith", the macro would create the file "John Smith.txt" in C:/Clients/

    Further more, in an attempt to prevent deletion of an already created filed, it would need to first confirm there is no John Smith.txt already located in the folder, then create the file. If there already is a John Smith.txt, it would simply move on to A2, A3, A4, etc performing that same task, until all of column A's cells have corresponding txt files.

    Thanks for your help guys.
    Last edited by stevedes7; 12-15-2009 at 11:58 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro That Creates Text Doc in specific folder based on cell value

    Steve, drop a note to the Moderators (DonKeyOte, Teylyn, Davesexcel, NBVC) and ask them to move your post to the correct forum, the Programming forum.

    ========
    As for the macro, you say "create a file named John Smith"...but you don't indicate what the content of that file should be. Sheet1? Sheet5? "Data"?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-26-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: Macro That Creates Text Doc in specific folder based on cell value

    I want it to be a blank file. Literally just a 0 kb .txt file with the person's name, placed in a specified folder.
    Last edited by stevedes7; 12-16-2009 at 01:56 AM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro That Creates Text Doc in specific folder based on cell value

    This should do it for you:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 12-16-2009 at 03:56 AM.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro That Creates Text Doc in specific folder based on cell value

    thread moved to Programming...

+ 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