+ Reply to Thread
Results 1 to 5 of 5

Dynamic file naming in VBA

  1. #1
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Dynamic file naming in VBA

    Hi

    I have written a basic macro that extracts data from an xl spreadsheet and creates a txt file. THe only issue I am having is determining how to automatically name the file as it needs to populate todays date in the file name.

    i.e. the file name will be something like "FB upload [date].txt"

    If someone could let me know how to do this I would be most grateful

    thanks
    Last edited by dperry; 10-04-2011 at 02:23 PM.

  2. #2
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    27,132

    Re: Dynamic file naming in VBA

    Hi,

    Try something like

    Please Login or Register  to view this content.
    Regards
    Richard Buttrey

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Dynamic file naming in VBA

    Thanks Richard

    Though I'm not sure where to insert this code... the current naming code is:

    Please Login or Register  to view this content.
    How do I use the code you suggested?

    thanks

  4. #4
    Forum Contributor
    Join Date
    09-07-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    356

    Re: Dynamic file naming in VBA

    Please Login or Register  to view this content.
    For me the file would come out as: FB Upload 03-10-2011

  5. #5
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Dynamic file naming in VBA

    Awesome, thanks for your help. This works perfectly

+ 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