Results 1 to 2 of 2

Thread: newbie in trouble

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    1

    newbie in trouble

    Hello everyone
    I'm new at vb, but I need to do something for my boss
    arggggg

    I need to grab in a bunch of word files and make a TOC with date, name and date modified, and each time I add a file to the directory it adds the same file to the TOC

    Thks

    Isabel

  2. #2
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    I don't understand. Where do ou get the "bunch of names"? Every doc in a certain directory? Also sounds like you want a list f document properties, not a Table Of Contents of those files. The first item you listed is "date". What date is that?

    This will return name and last updated for all doc files in a diectory.

    VB Code:
    1. Sub GetFileStuff()
    2.  
    3.     Dim strMyPath, objFSO, objFiles, objFile, strOutput
    4.  
    5.     strMyPath = "C:\My Documents\"
    6.    
    7.     Set objFSO = CreateObject("Scripting.FileSystemObject")
    8.     Set objFiles = objFSO.GetFolder(strMyPath).Files
    9.    
    10.     For Each objFile In objFiles
    11.         If Right$(objFile.Name, 4) = ".doc" Then
    12.             strOutput = strOutput & objFile.Name & vbTab & objFile.DateLastModified & vbCrLf
    13.         End If
    14.     Next
    15.    
    16.     Msgbox strOutput
    17.  
    18.     Set objFiles = Nothing
    19.     Set objFSO = Nothing
    20.  
    21. End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width