Results 1 to 3 of 3
  1. #1
    TomePremier
    Guest

    Browse screen (Word2K)

    Hello,
    From the Knowledge Base from Microsoft, I downloaded a useful macro's (see the attachment). I would like to use it with a browse screen and if possible with a search in the subfolders at the same time. How can this be done? Thanks in advance. Hans van der Meulen

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Browse screen (Word2K)

    Hello,

    To search for a subfolder as well, try replacing the relevant chunk of code in the macro posted, with the following chunk:

    <pre>' Search the specified folder for files and type the listing in the
    ' document.
    With Application.FileSearch
    .NewSearch
    .LookIn = X
    .SearchSubFolders = True
    .FileType = msoFileTypeAllFiles
    .Execute
    TotalFiles = .FoundFiles.Count
    If TotalFiles <> 0 Then
    </pre>

    Also, you should add the following line just before the End Sub:

    Set Folder = Nothing

    As far as a browse screen, what do you mean exactly? - do you want the found files listed in some kind of dialog box, from which the user can select a file to take some further action?

    Gary

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Browse screen (Word2K)

    Hello again,

    The attached sample document contains a userform and code which implements a (highly modified) version of the code which you posted, which was originally from MS KB article ##Q236162.

    Note that in the document or template that you run this code from, you must set a reference to the Microsoft Scripting Runtime library (in the VB Editor, Tools > References, scroll to locate and place a checkmark next to Microsoft Scripting Runtime).

    Hope someone finds this useful!

    Gary
    Attached Files Attached Files

Posting Permissions

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