+ Reply to Thread
Results 1 to 3 of 3

Workbook name

  1. #1
    nc
    Guest

    Workbook name

    If I have a list of Excel files in a specific folder, can anyone help me
    write a macro to obtain their names and enter it in a range as a list? If
    posible without opening the files.

    Thanks.


  2. #2
    Peter Jausovec
    Guest

    RE: Workbook name

    Hi,

    Try using this code:

    Sub Button1_Click()
    FillFileNames "C:\\", 1
    End Sub

    Public Sub FillFileNames(path As String, column As Integer)
    Dim MyFile As String
    Dim Counter As Integer
    Counter = 1

    MyFile = Dir$(path & "*.xls")
    Do While MyFile <> ""
    Sheet1.Cells(Counter, column).Value = MyFile
    MyFile = Dir$
    Counter = Counter + 1
    Loop
    End Sub

    Hope this helps.

    Peter
    --
    http://blog.jausovec.net


    "nc" wrote:

    > If I have a list of Excel files in a specific folder, can anyone help me
    > write a macro to obtain their names and enter it in a range as a list? If
    > posible without opening the files.
    >
    > Thanks.
    >


  3. #3
    Don Guillett
    Guest

    Re: Workbook name

    One way
    Sub FindExcelFiles()
    Application.ScreenUpdating = False
    Dim FN As String ' For File Name
    Dim ThisRow As Long
    Dim FileLocation As String
    FileLocation = "c:\ahorse\*.xls"
    FN = Dir(FileLocation)
    Do Until FN = ""
    ThisRow = ThisRow + 1
    Cells(ThisRow, 1) = FN
    FN = Dir
    Loop
    Application.ScreenUpdating = True
    End Sub

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "nc" <[email protected]> wrote in message
    news:[email protected]...
    > If I have a list of Excel files in a specific folder, can anyone help me
    > write a macro to obtain their names and enter it in a range as a list? If
    > posible without opening the files.
    >
    > Thanks.
    >




+ 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