how to show a copying dialog box when copying files in access vba
Posted on 2012-03-23
I have the following problem.
I copy some folders from location A to Location B through a vba code. When Files are big it takes time. All user see is hour glass , can I show some kind of status bar , or time remaining to finish copying?
My code is below:
FromPath = DriveLetter & "2077\" & DEVNUMBER 'The folder to copy
ToPath = DriveLetter & [Forms]![frm_log_in]![TXT_YEAR] & "\" & Me.Number & "\" & "docs" & "\" & DEVNUMBER & "\" 'The folder to paste
'If you want to create a backup of your folder every time you run this macro
'you can create a unique folder with a Date/Time stamp.
'ToPath = "C:\Users\Ron\" & Format(Now, "yyyy-mm-dd h-mm-ss")
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
FSO.CopyFolder Source:=FromPath, Destination:=ToPath
MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath