Hello,

I found the code below on this forum and it appears to work great. When copying folders/files it does not show the typical window that shows pages flying through the air. All it shows is an hour glass. I would like SOMETHING that indicates the folders/files are being copied and SOMETHING that shows when it is done. Am I on the right track with the code below and can I add a progress bar for the code below?

Thanks!

http://vbforums.com/showthread.php?t...y+files+folder

VB Code:
  1. Option Explicit
  2.  
  3. Private Type SHFILEOPSTRUCT
  4.         hwnd As Long
  5.         wFunc As Long
  6.         pFrom As String
  7.         pTo As String
  8.         fFlags As Integer
  9.         fAnyOperationsAborted As Long
  10.         hNameMappings As Long
  11.         lpszProgressTitle As String '  only used if FOF_SIMPLEPROGRESS
  12. End Type
  13.  
  14. Private Const FOF_MULTIDESTFILES = &H1
  15. Private Const FOF_CONFIRMMOUSE = &H2
  16. Private Const FOF_SILENT = &H4
  17. Private Const FOF_RENAMEONCOLLISION = &H8
  18. Private Const FOF_NOCONFIRMATION = &H10
  19. Private Const FOF_WANTMAPPINGHANDLE = &H20
  20. Private Const FOF_CREATEPROGRESSDLG = &H0
  21. Private Const FOF_ALLOWUNDO = &H40
  22. Private Const FOF_FILESONLY = &H80
  23. Private Const FOF_SIMPLEPROGRESS = &H100
  24. Private Const FOF_NOCONFIRMMKDIR = &H200
  25.  
  26. Private Const FO_MOVE = 1
  27. Private Const FO_COPY = 2
  28. Private Const FO_DELETE = 3
  29. Private Const FO_RENAME = 4
  30.  
  31. Private Declare Function SHFileOperation Lib "shell32.dll" (lpFileOp As SHFILEOPSTRUCT) As Long
  32.    
  33. Public Function CopyFolder(ByVal strSource As String, ByVal strDest As String) As Boolean
  34. '=========================================================================================
  35. Dim varFOS As SHFILEOPSTRUCT
  36.     With varFOS
  37.         .fFlags = FOF_NOCONFIRMATION Or FOF_SILENT Or FOF_NOCONFIRMMKDIR
  38.         .wFunc = FO_COPY
  39.         .pFrom = strSource
  40.         .pTo = strDest
  41.     End With
  42.     Call SHFileOperation(varFOS)
  43.     CopyFolder = (varFOS.fAnyOperationsAborted = 0)
  44. End Function
  45.  
  46. Private Sub Command1_Click()
  47.     CopyFolder "c:\temp\test", "c:\temp\test2"
  48. End Sub