Hi Folks
I am using the following code to zip up a selected folder but it doesn't work and I get the msg saying the file doesn't exist but it does exist, please help - thanks
---
I am using the following code to zip up a selected folder but it doesn't work and I get the msg saying the file doesn't exist but it does exist, please help - thanks
---
Code:
---
Set objFSO = CreateObject("Scripting.FileSystemObject")
sTempZipFolder = "c:\Temp"
sFileName = Chr$(34) & Me.txtFileToZipAttach.Value & Chr$(34)
sZipName = Chr$(34) & sTempZipFolder & "\Reports.zip" & Chr$(34)
If objFSO.FileExists(sFileName) Then
MsgBox sFileName & " exists"
Set objShell = CreateObject("WScript.Shell")
Set objCmd = objShell.Exec("C:\Program Files\WinZip\wzzip.exe -ybc" & " " & sZipName & " " & sFileName, 1, True)
Set objCmd = Nothing
Set objShell = Nothing
Else
MsgBox sFileName & " doesn't exist"
End If
---[Code]---