Zipping Excel files

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hi There,

I am trying to create a vba macro to automatically zip my
all excel file with use of SHELL command in vba but I am
unsuccessful. Can anyone check my code and tell me what's
wrong with it. What it does I am trying to use the
current date as my zip filename. When I run it seems
nothing happened and gives no error.

Sub ZIPMYFILE()
TempoFileDIR = Format(now, "yyyymmdd_hhmmss")

Dim TodaysArchive As String
Dim aBatchCopy As String
TodaysArchive = iArchivePath & TempoFileDIR & ".zip"
& " " & cWorkingPath
aBatchCopy = ("cmd /c PKZIPC -add -
directories=relative " & TodaysArchive)
Call Shell(aBatchCopy, vbHide)

End sub

TIA
Eric
 
Back
Top