Results 1 to 3 of 3

Thread: collect data automatically from a folder

  1. #1
    Join Date
    Mar 2010
    Posts
    4

    Exclamation collect data automatically from a folder

    Dear Friends,

    I have just signed here, so I am very new here.

    I need your help for my problem:

    suppose that i have a folder contains more than 200 text files (.txt) or may be other extension say .jpg, any way, I need a program to extract the names of these files and list them into an Excel sheet and set a hyperlink to these files, so that when i click any one in the Excel sheet it will be opened automatically.

    by the way: I am using VBA which installed automatically with Excel 2007.

    Thanks

  2. #2
    Join Date
    Dec 2009
    Posts
    80

    Re: collect data automatically from a folder

    Try to use the VBA code which i have mentioned below according to your need i hope that this will definitely help you to solve this issue.

    Code:
    Public Sub ListNames()
       Dim Directory As String
       Dim FileName As String
       Dim IndexSheet As Worksheet
       Dim r1 As Long
       
       'Change the directory below as needed
       Directory = "D:\Folder_name\"
       If Left(Directory, 1) <> "\" Then
           Directory = Directory & "\"
       End If
       
       r1 = 1
       
       Set IndexSheet = ThisWorkbook.ActiveSheet
           
       FileName = Dir(Directory & "*.*")
       Do While FileName <> ""
           IndexSheet.Cells(rw, 1).Value = FileName
           r1 = r1 + 1
           FileName = Dir
       Loop
       
       Set IndexSheet = Nothing
    End Sub
    Hope you got the result

  3. #3
    Join Date
    Mar 2010
    Posts
    4

    Re: collect data automatically from a folder

    I got it

    thank you very much

    regards

Similar Threads

  1. Replies: 2
    Last Post: 14-05-2012, 11:36 AM
  2. Replies: 3
    Last Post: 03-09-2009, 11:14 PM
  3. Folder Changed Automatically Into .exe
    By khaled.pasha in forum Windows Software
    Replies: 1
    Last Post: 17-12-2008, 04:50 PM
  4. Some Of The Folder Are Changed Into .exe Extension Automatically
    By khaled.pasha in forum Customize Desktop
    Replies: 2
    Last Post: 15-12-2008, 01:31 PM
  5. wpdnse folder appears automatically in temp folder
    By Charlie R in forum Windows XP Support
    Replies: 2
    Last Post: 18-11-2006, 09:09 PM

Tags for this Thread

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
  •  
Page generated in 1,713,939,777.62327 seconds with 17 queries