Results 1 to 4 of 4

Browse for File with Suggested Folder Location?

Threaded View

  1. #1
    Registered User
    Join Date
    07-27-2010
    Location
    Columbus, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Browse for File with Suggested Folder Location?

    Hello everyone,

    I'm just starting out learning how to program in VBA, and could use some help. Right now I'm trying to pull in an Excel file into Access and have some code for a dialog box that allows the user to search for a specific file. However, the file is nested deep within a folder structure, and takes forever to get to. I was wondering if there was a way to modify my code (or just new code altogether) that allows the user to search for a specific file, but gives me the option of starting at a set folder.

    Thanks!


    Current Code:
    Public Sub cmdFindFile(intX As Integer)
    
    Dim strImport As String
    Dim FD As FileDialog
    Dim FFs As FileDialogFilters
    Dim vrtFileName As Variant
    
    Set FD = Application.FileDialog(msoFileDialogFilePicker)
    
    With FD
        
        Set FFs = .Filters
        With FFs
            .Clear
            .Add "Comma Delimited", "*.csv"
            .Add "Excel", "*.xls"
        End With
        
        .AllowMultiSelect = False
        If .Show = False Then Exit Sub
        
        For Each vrtFileName In .SelectedItems
            Select Case intX
                Case 1: Forms!NC_Scorecard.Text = vrtFileName
                'Case 2: Me.txtManifest = vrtFileName
            End Select
        Next vrtFileName
    
    End With
    
    End Sub
    Last edited by Khirsah17; 07-28-2010 at 02:26 PM. Reason: Added code tags

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