This is what I have. The first function works. The second does not:
Option Compare Database
Dim wb As Workbook
Dim mypath As String
Dim myfile As String
Dim myExtension As String
Dim FldrPicker As FileDialog
Dim Filename As String
'Optimize Macro Speed
'Application.ScreenUpdating = False
'Application.EnableEvents = False
'Application.Calculation = xlCalculationManual
'Retrieve Target Folder Path From User
Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select A Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo NextCode
mypath = .SelectedItems(1) & ""
'In Case of Cancel
mypath = mypath
If mypath = "" Then GoTo ResetSettings
'Target File Extension (must include wildcard "*")
myExtension = "*.xlsx*"
'Target Path with Ending Extention
myfile = Dir(mypath & myExtension)
'Loop through each Excel file in folder
Do While myfile <> ""
'Set variable equal to opened workbook
Set wb = Workbooks.Open(Filename:=mypath & myfile)
'Ensure Workbook has opened before moving on to next line of code
'Change First Worksheet's Background Fill Blue
'wb.Worksheets(1).Range("A1:Z1").Interior.Color = RGB(51, 98, 174)
'Save and Close Workbook
'Ensure Workbook has closed before moving on to next line of code
'Get next file name
myfile = Dir
'Message Box when tasks are completed
MsgBox "Task Complete!"
'Reset Macro Optimization Settings
'Application.EnableEvents = True
'Application.Calculation = xlCalculationAutomatic
'Application.ScreenUpdating = True
mypath = "C:\Users\tzqy46\Documents\IMDS"
myfile = Dir()
Do While mymile <> ""
If myfile Like "*.xlsx" Then
'this will import ALL the excel files
'(one at a time, but automatically) in this folder.
' Make sure that's what you want.
DoCmd.TransferSpreadsheet acImport, 13, "IMDS", mypath & myfile
myfile = Dir()