Consulting

Results 1 to 8 of 8

Thread: That Missing file!!

  1. #1

    That Missing file!!

    I have a finance folder inside over 3000 multiple folders increment i.e.. 10020-Inv, 10021-Inv, etc..
    Each folder must have an invoice with folder reference 10021-inv.doc. 10021-inv.doc

    so..

    Folder name..... Invoice inside
    10020-Inv ..... 10020-inv.doc
    10021-Inv ..... 10021-inv.doc
    10022-Inv
    10023-Inv ..... 10023-inv.doc

    Folder 10022-Inv has NO Invoice inside folder
    I need a routine to search inside the Finance folder and subfolders
    And list which folders are missing invoice docs
    With folder name, and hyperlink folder location list on a spreadsheet.

    Any advice...

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    What Office version are you using?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Hi Malcom


    http://www.mrexcel.com/forum/showthread.php?t=457943

    Bootney, you may wish to read Here.

  4. #4
    Quote Originally Posted by mdmackillop
    What Office version are you using?
    Am Using Office 2003 - Excel 2003

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Bootney, did you follow the link that GTO provided?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You cannot hyperlink to a Folder
    [VBA]
    Sub Test()
    Dim arr() As String
    ReDim arr(4000)
    mypath = "c:\" '<===Change to suit
    myname = Dir(mypath, vbDirectory)
    Do While myname <> ""
    If myname <> "." And myname <> ".." Then
    If Left(myname, 3) = "100" Then
    arr(i) = mypath & myname
    i = i + 1
    End If
    End If
    myname = Dir
    Loop
    ReDim Preserve arr(i - 1)
    For j = 0 To i - 1
    fname = Dir(arr(j) & "\*.doc")
    If fname = "" Then
    k = k + 1
    Cells(k, 1) = arr(j)
    Else 'for debug check
    m = m + 1
    Cells(m, 5) = arr(j) & "\" & fname
    End If
    Next
    End Sub

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    Quote Originally Posted by mdmackillop
    You cannot hyperlink to a Folder
    [VBA]
    Sub Test()
    Dim arr() As String
    ReDim arr(4000)
    mypath = "c:\" '<===Change to suit
    myname = Dir(mypath, vbDirectory)
    Do While myname <> ""
    If myname <> "." And myname <> ".." Then
    If Left(myname, 3) = "100" Then
    arr(i) = mypath & myname
    i = i + 1
    End If
    End If
    myname = Dir
    Loop
    ReDim Preserve arr(i - 1)
    For j = 0 To i - 1
    fname = Dir(arr(j) & "\*.doc")
    If fname = "" Then
    k = k + 1
    Cells(k, 1) = arr(j)
    Else 'for debug check
    m = m + 1
    Cells(m, 5) = arr(j) & "\" & fname
    End If
    Next
    End Sub

    [/VBA]
    Could you tell me How this code works?

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    It checks for files starting with "100" and lists them in an array
    It checks each in the array to see if it contains a file; if not, it puts the name on the sheet in column 1 otherwise it puts the folder and filename in column 5
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •