Results 1 to 5 of 5

Macro to open a folder containing documents

Threaded View

  1. #1
    Registered User
    Join Date
    06-19-2012
    Location
    Liverpool
    MS-Off Ver
    Excel 2007
    Posts
    19

    Macro to open a folder containing documents

    Hi ppl,

    I am trying to create a macro that opens a folder which contains varous types of documents and then be able to select any of the documents and have it open in its corresponding application.

    An example of the folder I want to direct the user to and then the file types in the folder:

    TestFolder
    Word Doc1
    Word Doc1
    Excel Doc1
    powerpoint doc1
    MS project plan1

    I have got the code so it opens the folder and it sucessfully opens excel documents but if i try and open any other doc type it just opens a blank workbook.

    the code I'm using is as follows:

    Sub OpenFolder()
        
            ChDir "C:\IM PPM Toolkit\Project Manager\Project Folder\Agenda & Minutes\"
                Filename = Application.GetOpenFileName(FileFilter:=Filt, _
                FilterIndex:=FilterIndex, Title:=Title)
            If Filename = False Then
                Response = MsgBox("No File was selected")
                Exit Sub
            End If
              Response = MsgBox("You selected " & Filename, vbInformation, "Proceed")
            Workbooks.Open Filename
    
    End Sub
    I'm guessing it has something to do with the final line 'Workbooks.Open Filename' which looks like it is telling it to open the document in workbook format but I'm not sure how to resolve.

    Can someone help.

    Mnay thanks
    Last edited by arlu1201; 09-06-2012 at 08:31 AM.

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