+ Reply to Thread
Results 1 to 2 of 2

How to Browse for a file from within a userform

Hybrid View

j_Southern How to Browse for a file from... 01-27-2015, 06:10 PM
JieJenn Re: How to Browse for a file... 01-27-2015, 06:19 PM
  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    How to Browse for a file from within a userform

    This is a copy of a thread started in the wrong (Formulas ) section of the forum. I hope I am not breaking forum rules by trying to correct this.

    I have the following piece of code to pick up a known file name and open it.
    Sub FindFile()
    '
    ' Macro5 Macro
    '
    
    '
        ChDir "U:\EVERYBODY!\Windmill Printed Jobs\ABBSUD"
        Workbooks.Open Filename:= _
            "U:\EVERYBODY!\Windmill Printed Jobs\ABBSUD\ABBSUD 60 X 91 TRIAL.xls"
    End Sub
    This was derived directly from a macro generated from browsing my network.
    What I really want to do though is to enable my user to find the file using a browsing routine direct.
    I have not been able to find any advice about this and am hoping that someone here can help.
    John

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: How to Browse for a file from within a userform

    Maybe something like this might work
    Sub GetFolderName()
    Dim FilePath As String
        With Application.FileDialog(msoFileDialogFilePicker)
            .InitialFileName = Application.DefaultFilePath & "\"
            .Title = "Select the Excel File"
            .AllowMultiSelect = False
            .Show
                If .SelectedItems.Count = 0 Then
                    'Do Nothing
                    Exit Sub
                Else
                    FilePath = .SelectedItems(1)
                End If
        End With
        
        Workbooks.Open Filename:=FilePath
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calling a Browse routine from a UserForm
    By j_Southern in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2015, 06:23 AM
  2. Browse for a file and embed it in a userform to open in the future
    By chin67326 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2014, 03:07 AM
  3. importing sheets by browse button on userform
    By amarjeet.it in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2013, 03:45 AM
  4. How to browse & Attach a file to a userform in Excel?
    By rajat518 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2013, 05:04 AM
  5. [SOLVED] Browse and attach file in a UserForm
    By Jeroen Kluytmans in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2005, 06:06 AM

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