Sub Main()
Dim FileNameZip, FileNameXls
FileNameXls = "C:\Book1.xlsx"
FileNameZip = "C:\Book1.zip"
Call NewZip(FileNameZip)
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameZip).CopyHere FileNameXls
'因為FileNameXls比較大,而之後我需要將FileNameZip插入email為附件,所以我需要有這裡撿查及等待Zip file 完成才繼續下去。應該怎寫?
End Sub
'-------------------------------------------------------------
Sub NewZip(sPath)
'Create empty Zip File
If Len(Dir(sPath)) > 0 Then Kill sPath
Open sPath For Output As #1
Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)
Close #1
End Sub