reading floppy directory
Upcoming Power Excel Seminars
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: reading floppy directory

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Is there a way to read the floppy disk contents using VB and compare it to filenames in a worksheet?

    Thanks in advance for the help.

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi natExcel

    I answered this for you here:

    http://www.mrexcel.com/board/viewtop...c=2038&forum=2

  3. #3
    MrExcel MVP Joe Was's Avatar
    Join Date
    Feb 2002
    Location
    Central Florida, USA
    Posts
    7,539
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Sub Look_In_x()
    Dim lngCellCounter As Long
    Dim Message, Title, Default, MyDir
    'Search current directory for all files.

    Application.ScreenUpdating = False
    Message = "Enter the directory to search?" & Chr(13) & Chr(13) & "(Drive:DirectorySubDirectory)" ' Set prompt.
    Title = "Enter: Drive and Path!" ' Set title.
    Default = "A:" ' Set default.
    ' Display message, title, and default value.
    On Error GoTo myErr

    MyDir = InputBox(Message, Title, Default)

    With Application.FileSearch
    .NewSearch
    .FileType = msoFileTypeExcelWorkbooks
    .LookIn = MyDir
    .SearchSubFolders = True
    If .Execute() > 0 Then

    MsgBox "There were " & .FoundFiles.Count & " file(s) found."

    For lngCellCounter = 1 To .FoundFiles.Count
    Cells(lngCellCounter, 1) = .FoundFiles(lngCellCounter)
    Sheets("Sheet1").Select
    Next lngCellCounter

    Range("A1").Select
    Selection.EntireRow.Insert
    Range("AA2").Select
    Selection.Copy
    Range("A1").Select
    ActiveSheet.Paste
    Else

    MsgBox "No Excel WorkBooks found!"
    End If

    End With
    Application.ScreenUpdating = True
    End
    myErr:

    MsgBox "No Excel WorkBooks found!"

    End Sub

    This code will look for Excel workbooks on drive A: by default and print a list on sheet1 starting in cell A1 (Note: Cell AA2 could contain a title like: "This is the list of indicated files!"). You can also select any other drive or path?

    This last code will delete the posted list of files from the workbook containing the above code. Hope this helps. JSW

    Sub Delete_Data()
    'Delete the current screen print of file data.

    Application.ScreenUpdating = False
    Columns("A:A").Select
    Selection.ClearContents
    Range("A1").Select
    Selection.EntireRow.Delete
    Range("C1").Select
    Application.ScreenUpdating = True
    End Sub

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com