I'm currently using the following code to update a table from an Excel file.
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="Updated Table", FileName:="C:\updated.xlsx", HasFieldNames:=True
Exit_CmdImportExcel_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
Exit_Command0_Click:
End Sub
I would rather a button to choose the path to the excel file other than having it coded at C: because I can't guarantee the user is smart enough to move it there or that the excel file is going to be a xlsx file. Please help.
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="Updated Table", FileName:="C:\updated.xlsx", HasFieldNames:=True
Exit_CmdImportExcel_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
Exit_Command0_Click:
End Sub
I would rather a button to choose the path to the excel file other than having it coded at C: because I can't guarantee the user is smart enough to move it there or that the excel file is going to be a xlsx file. Please help.