+ Reply to Thread
Results 1 to 12 of 12

Get file name

  1. #1
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Get file name

    Hi everybody.
    I want to get the file name from the following code.
    Please Login or Register  to view this content.
    Who can help me.
    Thank you.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Re: Get file name

    As you're using FSO, you could use this in your For X loop

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Get file name

    The following will provide the file name. You can add the code to the end of your existing macro or
    maintain it as independent. I correct my previous statement ... ByteMarks has indicated how to obtain
    the file name.

    Please Login or Register  to view this content.
    Last edited by Logit; 01-16-2024 at 06:27 AM.

  4. #4
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    Quote Originally Posted by ByteMarks View Post
    As you're using FSO, you could use this in your For X loop

    Please Login or Register  to view this content.
    Please help me fully integrate it into the VBA code.

  5. #5
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    Quote Originally Posted by Logit View Post
    The following will provide the file name. You can add the code to the end of your existing macro or
    maintain it as independent. I correct my previous statement ... ByteMarks has indicated how to obtain
    the file name.

    Please Login or Register  to view this content.
    I want get the file name *.text, not the excel file.

  6. #6
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Re: Get file name

    Here you go.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    Quote Originally Posted by ByteMarks View Post
    Here you go.

    Please Login or Register  to view this content.
    Still not what I mean.
    What I mean is to get the *.text file name and assign it to a certain column in the Excel spreadsheet. For example, how to edit the code in column AA?

  8. #8
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,981

    Re: Get file name

    I'm not quite sure what you mean, but maybe this to put the file name in column AA

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    @ByteMarks:
    The key is in this line of code
    Des.Offset(, 26).Resize(K) = sFileName
    Thank you.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Get file name

    MsgBox at the bottom of the macro will get the file name ...

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    Quote Originally Posted by Logit View Post
    MsgBox at the bottom of the macro will get the file name ...

    Please Login or Register  to view this content.
    Can you help me fix the code to update multiple *.text files simultaneously?
    Thank you.

  12. #12
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Get file name

    I already know how.
    Thank you everybody.

+ 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. Replies: 5
    Last Post: 12-23-2022, 04:02 AM
  2. Replies: 8
    Last Post: 12-02-2019, 03:42 PM
  3. [SOLVED] File dialog box to open a excel file then copy data close file
    By mmikem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2019, 09:57 AM
  4. Macro - Open File Explorer, Select File, Import certain information from file
    By Drayde in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2015, 08:58 AM
  5. Save as macro that specifies file type, file location and takes file name from three cells
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-13-2013, 10:09 PM
  6. Open 2nd file(CSV) from cell reference, copy columns to main file & close 2nd file
    By Langchop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 05:09 AM
  7. Creating a .txt file extracting information from a Excel file saving as .resx file
    By AbdallahHajbed in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2012, 09:00 AM

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