Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!
Private Sub cmdImport_Click() Dim rec As DAO.Recordset Dim xls As Object Dim xlsSht As Object Dim xlsWrkBk As Object Dim xlsPath As String Dim xlsFile As String Dim fullXlsFile As String Dim fullFile As String Dim Msg, Style, title, Response Msg = "Importing is Done, Files are imported!" ' Define message. Style = vbOKOnly title = "Import Mesage" xlsPath = Me.txtFolder & "\" xlsFile = Dir(xlsPath & "*.xls", vbNormal) ' Retrieve the first entry. Do While xlsFile <> "" ' Ignore the current directory and the encompassing directory. fullXlsFile = xlsPath & xlsFile fullFile = xlsPath & xlsFile If Right(fullXlsFile, 4) = ".xls" Then 'import it DoCmd.SetWarnings False Set xls = CreateObject("Excel.Application") xls.Application.Visible = False xls.Application.displayalerts = False Set xlsWrkBk = GetObject(fullXlsFile) Set xlsSht = xlsWrkBk.Worksheets(1) 'NestSummary 'open table Set rec = CurrentDb.OpenRecordset("tblNestImport") rec.AddNew rec.Fields("NestID") = Nz(StrConv(xlsSht.cells(2, "E"), vbProperCase), "badnestid") rec.Fields("MaterialPartNumber") = Nz(StrConv(xlsSht.cells(5, "N"), vbProperCase), "badmaterialpartnumber") rec.Fields("TotalTime") = xlsSht.WorksheetFunction.Sum("G13:G100") rec.Update DoCmd.SetWarnings True End If 'close excel xlsWrkBk.Application.Quit Set xls = Nothing xlsFile = Dir() Loop Response = MsgBox(Msg, Style, title) End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.