+ Reply to Thread
Results 1 to 3 of 3

Can you open a file where the name of that file is in a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    04-24-2008
    Posts
    85

    Can you open a file where the name of that file is in a cell

    Hello, I have some code where I would like to open a date-stamped file. I was wondering if it is possible to replace 05212008 with, for example cell A1. In A1 I would put =today() and format it accordingly. Any suggestions would be great, I really do not know where I could find some information similar to this, I have been looking on a lot of different sites and tried to look for others who may have had a similar problem but no luck.

    Code is below, thanks for your time.

        Workbooks.OpenText Filename:="G:\FOLDER\05212008.txt", Origin:=437, _
            StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
            ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:=False _
            , Space:=True, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), Array _
            (3, 2), Array(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8, 1)), _
            TrailingMinusNumbers:=True
    AdamParker

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe


    Workbooks.OpenText Filename:="G:\FOLDER\" & Range("A1").Text &
    ".txt", Origin:=437, _
            StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
            ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:=False _
            , Space:=True, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), Array _
            (3, 2), Array(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8, 1)), _
            TrailingMinusNumbers:=True
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    04-24-2008
    Posts
    85
    Works like a charm! Thanks!

+ 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