Hi All,

I wan to send a single file into zip using shell in vba, Not sure what wrong with this code that this copied all the Folder content into zip file. I know there is one method using WINZIP.EXE address but it PC dependent so i want to avoid that. Thanks in Advance.

Sub TestRun()

Call Zip("C:\Users\Desktop\Excel VBA\Test\", "Test.xlsx")

End Sub



Sub Zip(strTargetPath As String, Fname As Variant)

Dim oApp As Object

zipfile = strTargetPath & "Test.zip"
Open zipfile For Output As #1

Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)

Set oApp = CreateObject("Shell.Application")

oApp.Namespace(strTargetPath & Fname).CopyHere Fname

End Sub