ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Zipping Excel files (https://www.excelbanter.com/excel-programming/277690-zipping-excel-files.html)

Eric[_6_]

Zipping Excel files
 
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



Ron de Bruin

Zipping Excel files
 
See a example on my site Eric
I will release my new SendMail Add-in soon (this can zip also)

http://www.rondebruin.nl/sendmail.htm#Zip


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eric" wrote in message ...
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





Ron de Bruin

Zipping Excel files
 
Oops

You are using PKZIPC
I am not familiar with this program


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message ...
See a example on my site Eric
I will release my new SendMail Add-in soon (this can zip also)

http://www.rondebruin.nl/sendmail.htm#Zip


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eric" wrote in message ...
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








All times are GMT +1. The time now is 05:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com