Prøv denne:
'*******Code Start**************
Option Explicit
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Boolean
hNameMappings As Long
lpszProgressTitle As String
End Type
Private Const FO_MOVE As Long = &H1
Private Const FO_COPY As Long = &H2
Private Const FO_DELETE As Long = &H3
Private Const FO_RENAME As Long = &H4
Private Const FOF_MULTIDESTFILES As Long = &H1
Private Const FOF_CONFIRMMOUSE As Long = &H2
Private Const FOF_SILENT As Long = &H4
Private Const FOF_RENAMEONCOLLISION As Long = &H8
Private Const FOF_NOCONFIRMATION As Long = &H10
Private Const FOF_WANTMAPPINGHANDLE As Long = &H20
Private Const FOF_CREATEPROGRESSDLG As Long = &H0
Private Const FOF_ALLOWUNDO As Long = &H40
Private Const FOF_FILESONLY As Long = &H80
Private Const FOF_SIMPLEPROGRESS As Long = &H100
Private Const FOF_NOCONFIRMMKDIR As Long = &H200
Private Declare Function apiSHFileOperation Lib "shell32.dll" _
Alias "SHFileOperationA" _
(lpFileOp As SHFILEOPSTRUCT) _
As Long
Function CopyFileAPI(strFrom As String, strTo As String) As Boolean
On Error GoTo Err_CopyFileAPI
Dim tshFileOp As SHFILEOPSTRUCT
Dim lngRet As Long
Dim lngFlags As Long
lngFlags = FOF_FILESONLY Or FOF_NOCONFIRMATION Or FOF_SIMPLEPROGRESS
With tshFileOp
.wFunc = FO_COPY
' .hwnd = Me.hwnd 'giver fejl under VB
.pFrom = strFrom & vbNullChar
.pTo = strTo & vbNullChar
.fFlags = lngFlags
'.lpszProgressTitle = ???
End With
lngRet = apiSHFileOperation(tshFileOp)
CopyFileAPI = (lngRet = 0)
Exit_CopyFileAPI:
Exit Function
Err_CopyFileAPI:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Resume Exit_CopyFileAPI
End Function
'********Code End *****************
Så kan du kopiere, flytte, slette etc. mapper og/eller filer
BG
"Ditte og Anders Zuschlag" <zuschlag@mail.tele.dk> wrote in message
news:9n07ak$2u8$1@sunsite.dk...
> Hej
> VB5.0
> Med filecopy kan man kopiere en fil til og fra osv.
> Er der dog ikke en nem måde at kopiere en HEL mappe incl undermapper på?
>
> Jeg har fået den ide at ville spørge brugeren om han er interesseret i at
få
> kopieret en mappe med forskelligt indhold fra en cd'en med applik. til
> harddisken. Nu skal han kunne svare ja eller nej, men jeg vil ikke spørge
> ham om alle 200 filer, men bare om mappen
> Håber det kan forstås!
> VH AZ
>
>