Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    list files macro (word 97/ win XP)

    I'm looking for a macro (had it, lost it) that will print out a list of all the files in a directory. you ran the macro, clicked open a directory, clicked on a document, and voila! it gave a list of all the files in that directory. i recently upgraded from windows 98 to XP but kept old Word; now the macro won't work. any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: list files macro (word 97/ win XP)

    Welcome to Woody's Lounge!

    > had it, lost it
    > now the macro won't work

    Do you have a macro but it doesn't work any more? If so, please post the code.

    Here is possible code for a macro that will list files in a folder into a document:

    Sub ListFiles()
    Dim strFolder As String
    Dim strFile As String
    strFolder = BrowseFolder
    If strFolder = "" Then Exit Sub
    Selection.EndKey Unit:=wdStory
    Selection.TypeText "Files in " & strFolder
    Selection.TypeParagraph
    If Not Right(strFolder, 1) = "" Then
    strFolder = strFolder & ""
    End If
    strFile = Dir(strFolder & "*.*")
    Do While Not (strFile = "")
    Selection.TypeText strFile
    Selection.TypeParagraph
    strFile = Dir
    Loop
    End Sub

    If you want a utility to print folders, check out the free Karen's Directory Printer (this is a standane application).

  3. #3
    New Lounger
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: list files macro (word 97/ win XP)

    thanks for the link to Karen. her program worked like i need. i appreciate all the help i get from the forum! you're great to share your expertise like this. K

Posting Permissions

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