T
THE_RAMONES
I'm uploading multiple "xls" files and delete when complete... I would like
to move files to an archive location then delete... below is the code I'm
using... Any help would be appreciate it.. thanks
Function ImportPFFS_Flat()
Set fs = Application.FileSearch
With fs
.LookIn =
"\\NASWin1.ad.wellcare.com\Dept\MemberServices\CommandCenterReport\Files2Upload\PFFS\"
.Filename = "WCARE_DAILY_CONTACT_LOG_2**.xls"
If .Execute > 0 Then
importfilecount = .Foundfiles.Count
For i = 1 To .Foundfiles.Count
Dim strFile As String
Dim strPath As String
Dim stDocName As String
'Loop through the string & import the files
'
DoCmd.Echo False, ""
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acImport, , "xls_PFFS_Direct", _
.Foundfiles(i), True, ""
DoCmd.Echo True, "Import Completed"
DoCmd.SetWarnings True
Kill .Foundfiles(i)
'FileDateTime (.Foundfiles(i))
Next i
Else
Exit Function
On Error GoTo ImportMacro_Err
End If
End With
ImportMacro_Exit:
Exit Function
ImportMacro_Err:
MsgBox Error$
Resume ImportMacro_Exit
End Function
to move files to an archive location then delete... below is the code I'm
using... Any help would be appreciate it.. thanks
Function ImportPFFS_Flat()
Set fs = Application.FileSearch
With fs
.LookIn =
"\\NASWin1.ad.wellcare.com\Dept\MemberServices\CommandCenterReport\Files2Upload\PFFS\"
.Filename = "WCARE_DAILY_CONTACT_LOG_2**.xls"
If .Execute > 0 Then
importfilecount = .Foundfiles.Count
For i = 1 To .Foundfiles.Count
Dim strFile As String
Dim strPath As String
Dim stDocName As String
'Loop through the string & import the files
'
DoCmd.Echo False, ""
DoCmd.SetWarnings False
DoCmd.TransferSpreadsheet acImport, , "xls_PFFS_Direct", _
.Foundfiles(i), True, ""
DoCmd.Echo True, "Import Completed"
DoCmd.SetWarnings True
Kill .Foundfiles(i)
'FileDateTime (.Foundfiles(i))
Next i
Else
Exit Function
On Error GoTo ImportMacro_Err
End If
End With
ImportMacro_Exit:
Exit Function
ImportMacro_Err:
MsgBox Error$
Resume ImportMacro_Exit
End Function