+ Reply to Thread
Results 1 to 4 of 4

Get files in a directory

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Get files in a directory

    Hello,

    I am using the following code:


    Please Login or Register  to view this content.
    The problems I run into are:

    1. Always, the last two messages are empty boxes.
    2 Always, I am getting one more message box than the file counts in MyPath

    What is wrong here?
    Could you please advise?
    Thanks

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Get files in a directory

    You need to swap these two lines round
    Please Login or Register  to view this content.
    at the moment you won't get the name of the first file, as you are changing the value of strFile before you display it in the message box.

  3. #3
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Get files in a directory

    Yes, it works.
    Thank you!

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,120

    Re: Get files in a directory

    You're welcome & thanks for the feedback.

+ 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] macro to copy excel files only from main directory and sub directory to a specific folder
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2019, 09:49 AM
  2. [SOLVED] Want to show files from directory and sub directory too
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-03-2017, 04:00 PM
  3. Moving Files from one directory structure to another directory
    By harddd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2013, 02:39 PM
  4. [SOLVED] Macro to Import Multiple TXT Files into workbook - User to select files/directory
    By saber007 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2013, 08:43 PM
  5. Replies: 0
    Last Post: 03-13-2013, 09:08 PM
  6. Macro to Move files from one directory to other directory
    By Shanthuday in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2013, 07:21 AM
  7. Reading in the files in a directory into an array, directory chosen by user
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-18-2011, 12:52 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