Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    button to open folder (97)

    I attached the following code (in a spreadsheet) to a button. Clicking on the button opens the specified file.

    Dim filetoopen
    filetoopen = "S:FLIGHTSjan04.xls"
    Workbooks.Open filetoopen

    What code do I need to open the folder "FLIGHTS" dialog box. (So I can then click on whatever file I want to open in that folder).

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

    Re: button to open folder (97)

    Something like

    Dim fileToOpen As Variant
    ChDrive "S"
    ChDir "S:Flights"
    fileToOpen = Application.GetOpenFilename("Excel workbooks (*.xls),*.xls")
    If Not fileToOpen = False Then
    Workbooks.Open fileToOpen
    End If

  3. #3
    Star Lounger
    Join Date
    Mar 2001
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: button to open folder (97)

    I'm getting a path error, though my path seems right.

    Can I simplify...
    What code do I need to simulate hitting the "open" button in the menu bar?

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

    Re: button to open folder (97)

    This is the equivalent of File | Open:

    Application.Dialogs(xlDialogOpen).Show

Posting Permissions

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