hello.
i would like to be able to move files from one folder to another then delete the original files.
I dont think im passsing the variables to the functions corectly.
been trying this for a while now and cant get it.
and help would greatly be appresated.![]()
Sub Move_DeleteFiles() Dim var_File Dim int_FileCount As Integer Dim str_FileName As String Dim str_FileExt As String Dim str_FileNameExt As String var_File = Application.GetOpenFilename _ (Title:="Please select the Files you wish to import.", _ MultiSelect:=True) If IsArray(var_File) Then For int_FileCount = 1 To UBound(var_File) str_FileName = ExtractFileName(var_File(int_FileCount)) str_FileExt = GetFileType(var_File(int_FileCount)) str_FileNameExt = str_FileName & str_FileExt FileCopy var_File, _ ("C:\Documents and Settings\1 1\Desktop\Test2\" & str_FileNameExt) Next int_FileCount End If 'Kill var_File End Sub Function ExtractFileName(var_File As String) As String ' extract filename portion of filename, no extension Dim str_FileName As String str_FileName = Right(filename, Len(var_File(int_FileCount)) - InStrRev(var_File(int_FileCount), "\")) str_FileName = Replace(fileN, GetFileType(str_FileName), "") ExtractFileName = str_FileName End Function Function GetFileType(var_File As String) As String ' get file extension GetFileType = Mid$(var_File(int_FileCount), InStrRev(var_File(int_FileCount), "."), Len(var_File(int_FileCount))) End Function
cheers











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks