+ Reply to Thread
Results 1 to 13 of 13

Macro to Open specific files in a Folder

  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Macro to Open specific files in a Folder

    Hi,

    I want a Macro that opens a folders, brows through the files and opens only those that in the file name have the date between 26/10/2012 - 09/11/2012 (Today).
    Is that possible. If so, how could I do that?

    Thanks a lot!

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro to Open specific files in a Folder

    Yes, it's possible, but paste here some filenames
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Open specific files in a Folder

    Will your start date be static? For e.g. Today will keep changing as you run the macro on different days, will 26/10 always be 26/10?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro to Open specific files in a Folder

    All files names will have the same format:

    Shipment- No. Shipment-City-Date (Year-Month-Day)

    Example: Shipment-34566-LAREDO-2012-11-10

    The No.Shipment, City and Date will vary accordingly. Those files will be added daily to the folder so I want a macro that only opens the files from the past 15 days and performs a subroutine.

    Thanks a lot!

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro to Open specific files in a Folder

    No extension (.xls) in your filenames ? please attach a view of your folder

  6. #6
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro to Open specific files in a Folder

    Hi,

    I attach a view of my folder. For the moment the files are extension .xlsm but thye are to be modified to be saved as .xls.
    Hope you can help me!

    Regards
    Attached Files Attached Files

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Open specific files in a Folder

    Once the files are opened, action taken, they can be re-saved as .xls. What actions do you need to be performed?

  8. #8
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro to Open specific files in a Folder

    Hi,

    I just need to copy some rows from the files that are going to be opened and close them without saving anything (there will be no changes performed to the files).

    Regards!!

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Open specific files in a Folder

    But you said you want to save them as .xls?

    These rows need to be copied to 1 file? Which are the ranges to be copied?

  10. #10
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro to Open specific files in a Folder

    Sorry what I meant is that the files are going to be in the folder with extension .xls. I am performing a few tests and that is why they are saved as .xlsm, but I donīt want the macro to perform that change of extension. What I want the macro to do is open the files that have in the filename the past 15 days, copy certian rows (the ranges to be copied are not going to be static because they may vary depending on each file) and close the files.

    Regards!!

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Open specific files in a Folder

    So how would the macro determine which rows need to be copied?

  12. #12
    Registered User
    Join Date
    11-08-2012
    Location
    Mexico
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro to Open specific files in a Folder

    It will copy until the last cell that has text. I got that figured out, what I donīt know is the opening files part!

  13. #13
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Open specific files in a Folder

    Can you provide a few more examples of your file names?

+ 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