+ Reply to Thread
Results 1 to 6 of 6

Import dynamic filname

  1. #1
    Registered User
    Join Date
    04-19-2013
    Location
    midwest usa
    MS-Off Ver
    2007, 2010
    Posts
    16

    Import dynamic filname

    I'm importing some CSVs that have names that change every month (oct13, nov13, dec13, etc.)

    I would like to create a variable that contains a wildcard, but VBA doesn't seem to like what I've written.

    If I write the whole file name in, it works correctly, but if I add in an *, it doesn't
    • This variable works --> strFileName = "Oct13_Future" & ".csv"
    • This is what I'm trying to accomplish --> strFileName = "*" & "_Future" & ".csv"

    Any assistance would be greatly appreciated.

    Thanks,
    7

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Import dynamic filname

    Perhaps a construction along these lines if you a checking a number of files in a folder?

    Please Login or Register  to view this content.
    Alf
    Last edited by Alf; 11-01-2013 at 04:55 AM. Reason: fixed what I did wrong before.

  3. #3
    Registered User
    Join Date
    04-19-2013
    Location
    midwest usa
    MS-Off Ver
    2007, 2010
    Posts
    16

    Re: Import dynamic filname

    not sure how to work that into my script, as I think I need the full filename to build my connection.

    here's what I've got so far, and it works, but since the filenames will change each month, I need the strConnection variable to be dynamic.

    again; any help will be greatly appreciated

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-19-2013
    Location
    midwest usa
    MS-Off Ver
    2007, 2010
    Posts
    16

    Re: Import dynamic filname

    edit: double post
    Last edited by Sevn; 11-01-2013 at 10:34 AM. Reason: duplicate

  5. #5
    Registered User
    Join Date
    04-19-2013
    Location
    midwest usa
    MS-Off Ver
    2007, 2010
    Posts
    16

    Re: Import dynamic filname

    ok, it's a little rough around the edges, but I got it figured out. Thanks for your help.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: Import dynamic filname

    ok, it's a little rough around the edges, but I got it figured out.
    Perhaps it is but it works and that is the main thing! Thanks for feedback and rep.

    Alf

    Ps As this seems to fix your problem don't forget to mark thread "Solved"

    To mark your thread solved do the following:
    New Method
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved
    Last edited by Alf; 11-02-2013 at 05:08 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Power Pivot SQL Data Import - How to update import filter
    By minnesotaart in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-29-2013, 12:39 PM
  2. Implementing TextFile import Delimiter settings on TXT Import VBA Script
    By Canuckle777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-19-2013, 02:06 PM
  3. Macro that change filname i series if one already exists
    By Gamla kläder in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2013, 02:52 AM
  4. Dynamic Import of External Data Depending on Date
    By jponte in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2009, 01:43 PM
  5. Dynamic Field Name when Import into Access
    By pickledmuffin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2008, 10:13 PM

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