Show progress of copying

J

Joe

Dear all,

I am using Excel 2003 SP2 and VB 6.3

I am trying to use Excel to copy from the server.
for that I use "scripting.filesystemobject" to get the list of files.

'my code is..........
'**********************
Function Copy_Data(ByVal fromFolder As String, ByVal toFolder As
String)

Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")
FSO.copyfolder fromFolder, toFolder

End Function
'**********************

I need to show some kind of progress window. Since the folders are
very big, it takes a lot of time to finish copying.. Is it possible
to show any progress and if so how?????

Thank you.....

Reagrds
Joe
 
S

Steve Yandl

Joe,

It's not nearly as well documented but if you use the "Shell.Application"
object rather than the "Scripting.FileSystemObject" to copy the folder, you
will get the standard Windows Explorer show progress bar for copying or
moving files and folders. Try something like:

Sub CopyShowProgress()
Const FOF_SIMPLEPROGRESS = &H100
Dim Shell, Folder
toFldr = "C:\Temp"
fromFldr = "C:\Test"
Set Shell = CreateObject("Shell.Application")
Set Folder = Shell.Namespace(fromFldr)
Folder.CopyHere toFldr, FOF_SIMPLEPROGRESS
Set Shell = Nothing
End Sub

Steve
 
J

Joe

Joe,

It's not nearly as well documented but if you use the "Shell.Application"
object rather than the "Scripting.FileSystemObject" to copy the folder, you
will get the standard Windows Explorer show progress bar for copying or
moving files and folders. Try something like:

Sub CopyShowProgress()
Const FOF_SIMPLEPROGRESS = &H100
Dim Shell, Folder
toFldr = "C:\Temp"
fromFldr = "C:\Test"
Set Shell = CreateObject("Shell.Application")
Set Folder = Shell.Namespace(fromFldr)
Folder.CopyHere toFldr, FOF_SIMPLEPROGRESS
Set Shell = Nothing
End Sub

Steve














- Show quoted text -

Thank you Steve.
This sounded like what I need. But unfortunately its not working for
me :(

my code is as below...

'**************************
Private Sub CommandButton2_Click()

Const FOF_SIMPLEPROGRESS = &H100
Dim fromFldr, toFldr As String
Dim Shell, Folder As Object

toFldr = "C:\Test\Input"
fromFldr = "C:\Test\Server\071029_P103_1"

Set Shell = CreateObject("Shell.Application")
Set Folder = Shell.Namespace(fromFldr)
Folder.CopyHere toFldr, FOF_SIMPLEPROGRESS
'Set Shell = Nothing

End Sub
'**************************

I tried this way as well.. Boz I saw like that in one site..
Const FOF_SIMPLEPROGRESS = &H100&
But no use...


I get the following error...
Run-time error '5':
Invalid procedure call or argument

This error is for the "Folder.CopyHere .." argument..

Do u know why????

Regards
Joe.
 
S

Steve Yandl

Try changing
Const FOF_SIMPLEPROGRESS = &H100&
to
Const FOF_SIMPLEPROGRESS = &H100

or simply copy my subroutine from my post and substitute correct path
strings for your scenario as a test.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top