I've been at this for ages and can't seem to get it to work.
The error I get is a byref argument type mismatch. I'm not sure if it is possible to use FileCopy in this manner. The destination Folder is being generated daily for archiving purposes so the name is different every day. Can someone please help, I'm really stuck with this problem. ThanksCode:Private Function MakeFolder(NewDir As String) Dim dirname As String dirname = "C:\TestOrator\" NewDir = dirname & NewDir MkDir NewDir End Function Private Sub Archive_Click() today = Format(Now, "dd mmmm yyyy") MakeFolder (today) Call CopyA End Sub Public Sub CopyA() Dim FSO As Object On Error GoTo NOFSO Set FSO = CreateObject("Scripting.FileSystemObject") today = Format(Now, "dd mmmm yyyy") On Error Resume Next FSO.CopyFile "C:\TestOrator\Outgone\*.gen", Makefolder(today), True FSO.DeleteFile "C:\TestOrator\Outgone\*.gen" Set FSO = Nothing Exit Sub NOFSO: MsgBox "FSO CreateObject Failed, Copying of files" End Sub




Reply With Quote