+ Reply to Thread
Results 1 to 5 of 5

Looking up files

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Looking up files

    I have an application which has as its input, filed workbooks. Each workbook has one used worksheet and I need to copy this into my application.
    I would like to automate the process by having some kind of lookup of the file names which could then be opened and copied onto a sheet in the application.
    The files are organised as follows U:\JobNames\CustomerName\Job.xls
    Is this going to be possible?
    I wonder if it would be possible to create a list of all the files that could be loaded onto a worksheet when the application is opened. I could certainly work with that.
    John

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Looking up files

    Your request is unclear.

    What are you wanting specifically?
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Looking up files

    Sorry not to be clear.

    I have a few hundreds of excel workbooks all with one sheet containing data. These are all in one folder "JobNames". This contains a folder for each customer and each customer folder can have from 1 to 50 of the workbooks I want to load.

    So U:|JobNames\CustomerNames\Job.xlsm

    I want to be able to have a list of file names so that one can be chosen to be loaded into my application, without reopening Excel manually and loading a file that way and then copying and pasting into the application.

    I think I could do this if there was no "CustomerName" Sub folder, but this has defeated me so far.

    I hope that my request is clearer and you can help.
    John

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Looking up files

    I have made some progress on my problem and come up with the following
    [CODE][/Sub NewFile_Button3_Click()
    Dim strF As String
    Dim FilePath As String
    customerName = Sheets("NewFile").CBCusName.Value

    A = 0
    FilePath = "U:\Everybody!\Windmill_ Printed _Jobs\" & customerName & "\"



    Sheets("File_List").Range("A:E").Clear
    strF = Dir(FilePath)
    With Sheets("File_List")
    .Columns("A").ClearContents
    Do While Len(strF) > 0
    .Cells(.Rows.Count, "A").End(xlUp).Offset(1).Value = strF

    strF = Dir()
    A = A + 1
    Loop
    End WithCODE]
    This works but there is a difficulty which is that the customer name list I used to populate a combo box (line marked *****) is not exactly the same as the customer names that have been used to create the file names.

    To overcome this I would like to be able to scan through all the members of Windmill_ Printed _Jobs and pick out the "Customername" part of the FilePath to use as a list for the combobox.
    Dir() does not let me do this.
    How can I do this?
    John

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Looking up files

    I have managed to solve this problem myself by finding that you can display the windows file browsing window in VBA. A much more elegant solution than the one I had envisaged.
    John

+ 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. split text files stored in some location to multiple files based on a condition
    By GIRISH_KH in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2013, 11:32 AM
  2. [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
  3. Replies: 0
    Last Post: 04-13-2013, 10:45 AM
  4. Replies: 0
    Last Post: 03-15-2012, 04:13 PM
  5. Application.GetOpenFilename, Attach files to Email, Move files, Delete Original.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2009, 12:11 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