Public Function CopyFiles(SourceDir As String, DestinationDir As String) As Boolean Dim stName As String
On Error GoTo err_FillFiles
stName = Dir(SourceDir & "\*.*") Do While stName <> "" On Error Resume Next If (GetAttr(SourceDir & stName) And vbDirectory) <> vbDirectory Then 'File Already open? If Err.Number = 5 Then Err.Clear
If stName <> "." Or stName <> ".." Then 'FileList.Add Item:=(stName) FileCopy SourceDir & "\" & stName, DestinationDir & "\" & stName End If End If 'Get Next entry stName = Dir Loop CopyFiles = True exit_FillFiles: Exit Function err_FillFiles: If Err.Number = 71 Then MsgBox AccessError(Err.Number) _ & " Prøv venligst igen. ", vbCritical + vbOKOnly, _ "Fejl ved læsning af drev " & SourceDir Else MsgBox Err & vbNewLine & vbNewLine & Err.Description, vbExclamation End If Resume exit_FillFiles End Function
martin_moth> I dont decide how many points are given for a question. In this case one could say that 200 is ample. And in other cases I have worked literally hours for only 30 points. But in the end it is the person placing the question who decided, NOT ME!
Jeg har da aldrig omtalt dig, terry...? Du har da intet med antal afsatte points at gøre
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.