[EXCEL] Cant Create Zip NameSpace
I am using the code from this site to create a zip file and copy all the files from a directory into it
http://www.rondebruin.nl/windowsxpzip.htm
However when I try to set the Namespace for the zip file I get an error saying Error=429: ActiveX component can't create object
Code:
Public Function zipAllFiles(folderName As Variant) As String
Dim FileNameZip
Dim strDate As String, DefPath As String
Dim fso As New FileSystemObject
Dim oApp As Object
Dim rootFolder As String
rootFolder = fso.GetParentFolderName(fso.GetFolder(folderName))
DefPath = fso.BuildPath(rootFolder, "Temp")
If Not fso.FolderExists(DefPath) Then
fso.CreateFolder (DefPath)
End If
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If
If Right(folderName, 1) <> "\" Then
folderName = folderName & "\"
End If
strDate = Format(Now, "dd-mmm-yyTh-mm-ss")
FileNameZip = DefPath & strDate & ".zip"
'Create empty Zip File
NewZip (FileNameZip)
'Copy the files to the compressed folder
Set oApp = CreateObject("Shell.Application")
Dim oFolder
Set oFolder= oApp.Namespace(folderName)
Dim ozip
Set ozip = oApp.Namespace((FileNameZip))
Creating the namespace for the folder works but not for the zip file
Adding "" & or enclosing in brackets does not work
I am wondering if Vista has an effect on this.
Or maybe because I have 7-Zip as my default compression manager.
:sick::(
Re: [EXCEL] Cant Create Zip NameSpace
Just tested on an XP machine and it works fine.
Vista issue perhaps?