title: How can I select a specific sheet from an Excel file to import into Access?
body: <p><a href="https://i.stack.imgur.com/NJ4bT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NJ4bT.png" alt=""></a></p>
  
  <p>In the image I show the interface through which I select the Excel file to import.</p>
  
  <p>It works perfect as long as you enter the name of the sheet in the code:</p>
  
  <p><code>DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "MYSTERY_SHOPPER", fileName, True, "Junio-2019!"</code></p>
  
  <p>However, I would like the user to select the sheet they want to import (perhaps with an inputbox to capture the name of the sheet?) since he should not enter each time and edit that line.</p>
  
  <p>SOLVED - Thaks to @June7</p>
  
  <pre><code>'----------------- BUTTON BROWSE
  
  Private Sub btnbuscar_Click()
  
  Dim diag2 As Office.FileDialog
  Dim Item2 As Variant
  
  Set diag2 = Application.FileDialog(msoFileDialogFilePicker)
  diag2.AllowMultiSelect = False
  diag2.Title = "Choose a Excel file"
  diag2.Filters.Clear
  diag2.Filters.Add "Excel files", "*.xls, *.xlsx"
  DoCmd.SetWarnings False
  
  If diag2.Show Then
      For Each Item2 In diag2.SelectedItems
          Me.etiquetaarchivo = Item2
      Next
  End If
  
  End Sub
  
  
  '---------------- BUTTON IMPORT
  
  Private Sub btnimportar_Click()
  
  Dim FSO2 As New FileSystemObject
  
  If Nz(Me.etiquetaarchivo, "") = "" Then
      MsgBox "You don't select a file!"
      Exit Sub
  End If
  
  If FSO2.FileExists(Nz(Me.etiquetaarchivo, "")) Then
  
      ExcelImport2.ImportExcelSpreadsheet Me.etiquetaarchivo, FSO2.GetFileName(Me.etiquetaarchivo)
      DoCmd.SetWarnings False
  
  Else
      MsgBox "Not file found!"
  End If
  
  
  '---------------- MODULE
  
  Public Sub ImportExcelSpreadsheet(fileName As String, tableName As String)
  On Error GoTo BadFormat
  
  Dim Hoja As String
  Hoja = inputbox("Input the sheet name")
      DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "MYSTERY_SHOPPER", fileName, True, Hoja &amp; "$"
      DoCmd.SetWarnings False
      Exit Sub
  
  BadFormat:
      MsgBox "The format isn't correct"
  End Sub
  
  </code></pre>