Another Simple VBA - Add to Zip
Posted on 2013-05-20
This should be such a no-brainer considering that you've posted the answer repeatedly. I just cannot get the following code to zip a file. I know the NewMo,ExportDir, and sDest are correct. In the immediate window, they correspond appropriately. Why doesn't the "sDest" add to an existing (ExportDir & NewMo & " WAs.zip") file?
Dim sDest As String
Dim NewRef As String
Dim NewMo As String
Dim ExportDir As String
NewMo = Format(Now(), "yyyymm")
ExportDir = "\\carefirst.com\corp\shared\Finance\Finance Shared\Cash Management\Receipts Allocations\WAs\"
sDest = ExportDir & NewRef & "_Direct Download STI-CSV with Text_0.txt"
Dim oApp As Object
Set oApp = CreateObject("Shell.Application")
oApp.NameSpace(ExportDir & NewMo & " WAs.zip").CopyHere sDest
Set oApp = Nothing