anoniem Geplaatst: 1 januari 2002 Delen Geplaatst: 1 januari 2002 Dag allemaal, ik heb de smaak te pakken en er lukt telkens meer met VB. Echter wil ik nu bestanden kopieren en ergens elders weer opslaan, ik hoef dus niet te openen met VB alleen verplaatsen. Bijvoorbeeld een plaatje op de D: naar de F: mapThanx Quote Link naar reactie
anoniem Geplaatst: 1 januari 2002 Auteur Delen Geplaatst: 1 januari 2002 Hoop dat je hier wat aan hebt FileCopy Statement Copies a file.SyntaxFileCopy source, destinationThe FileCopy statement syntax has these named arguments:Part Description ----------------------- source Required. String expression that specifies the name of the file to be copied. The source may include directory or folder, and drive. destination Required. String expression that specifies the target file name. The destination may include directory or folder, and drive. RemarksIf you try to use the FileCopy statement on a currently open file, an error occurs. Quote Link naar reactie
anoniem Geplaatst: 20 januari 2002 Auteur Delen Geplaatst: 20 januari 2002 Option Explicit Public 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 Public Declare Function SHFileOperation Lib "shell32.dll" Alias _ "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long Const FO_MOVE = &H1 Const FO_COPY = &H2 Const FO_DELETE = &H3 Const FO_RENAME = &H4 Const FOF_MULTIDESTFILES = &H1 Const FOF_CONFIRMMOUSE = &H2 ' Not Implemented yet Const FOF_SILENT = &H4 ' don't create progress/report Const FOF_RENAMEONCOLLISION = &H8 ' rename files on collision Const FOF_NOCONFIRMATION = &H10 ' Don't prompt the user. Const FOF_WANTMAPPINGHANDLE = &H20 ' Fill in SHFILEOPSTRUCT.hNameMappings ' Must be freed using SHFreeNameMappings Const FOF_ALLOWUNDO = &H40 Const FOF_FILESONLY = &H80 ' on *.*, do only files - not directories Const FOF_SIMPLEPROGRESS = &H100 ' means don't show names of files Const FOF_NOCONFIRMMKDIR = &H200 ' don't confirm making any needed dirs Const PO_DELETE = &H13 ' printer is being deleted Const PO_RENAME = &H14 ' printer is being renamed Const PO_PORTCHANGE = &H20 ' port this printer connected to is being changed ' if this id is set, the strings received by ' the copyhook are a doubly-null terminated ' list of strings. The first is the printer ' name and the second is the printer port. Const PO_REN_PORT = &H34 ' PO_RENAME and PO_PORTCHANGE at same time. Public Sub ShellCopyFile(strSource As String, strDest As String) Dim lResult As Long Dim SHF As SHFILEOPSTRUCT With SHF .hwnd = hwnd .wFunc = FO_COPY .pFrom = strSource & vbNullChar & vbNullChar .pTo = strDest & vbNullChar & vbNullChar .fFlags = FOF_FILESONLY End With lResult = SHFileOperation(SHF) If lResult Then MsgBox "Error occurred!", vbInformation, "SHCOPY" End If End Sub Quote Link naar reactie
Aanbevolen berichten
Om een reactie te plaatsen, moet je eerst inloggen