0

I have a piece of code that zips two files:

 'Deleting ZIP file and creating new one
  Set FSO = CreateObject("Scripting.FileSystemObject")
    if fso.fileExists("C:\Test.zip") then
    fso.DeleteFile("C:\Test.zip")
    end if

  ' creating zip file
  set file = FSO.CreateTextFile("Test.zip")
  file.write("PK" & chr(5) & chr(6) & string(18,chr(0)))
  file.close

  'Coping files to ZIP file 
  Set objShell = CreateObject("shell.Application")

  Set objFolderZIP = objShell.NameSpace("C:\Test.zip")

  cnt = objFolderZIP.Items.Count + 1
  objFolderZIP.CopyHere("C:\Zip01.xls")
  While objFolderZIP.Items.Count < cnt
      WScript.Sleep 100
  Wend

  cnt = objFolderZIP.Items.Count + 1
  objFolderZIP.CopyHere("C:\Zip02.xls")
  While objFolderZIP.Items.Count < cnt
      WScript.Sleep 100
  wend


MsgBox "Files ZIP-ed"

Both files are copied to .zip folder with no issues. Problem is that, if files are large, message box "Files ZIP-ed" is popping up while files are still being compressed, there is loading bar for compressing. I would like pop up message to appear after files are completely compressed(copied to .zip file).

IGRACH
  • 3,506
  • 6
  • 33
  • 48
  • Well actually yes. If "Folder.CopyHere method does not return a value and no notification is given to the calling program to indicate that the copy has completed". Then I'm guessing that it can not be done. – IGRACH Jun 13 '19 at 22:03
  • 1
    [But the script will wait for progress dialog box which starts in case of huge files](https://stackoverflow.com/a/26240525/3439404). – JosefZ Jun 13 '19 at 22:22
  • Can you please point out what part of the code does that. I'm unable to find it. – IGRACH Jun 18 '19 at 22:26

0 Answers0