Hi,
I'm running an archiving process from an Access database which uses a Shell object to compress files to a new location.
I want to suppress the standard Windows "Compressing..." message so that the process just runs unobtrusively in the background.
This article suggest that all I need to do is supply a second argument to my .CopyHere call, but this doesn't work.
Any ideas as to how I might do this? Code I'm running:
I'm running an archiving process from an Access database which uses a Shell object to compress files to a new location.
I want to suppress the standard Windows "Compressing..." message so that the process just runs unobtrusively in the background.
This article suggest that all I need to do is supply a second argument to my .CopyHere call, but this doesn't work.
Any ideas as to how I might do this? Code I'm running:
Code:
Public Sub Zip_File(strFileName, strZipFileName)
' use built in Windows functionality to zip files
Dim strDate As String
Dim objShell As Object
'Create empty Zip File
Call Create_New_Zip_File(strZipFileName)
' create a new windows shell object
Set objShell = CreateObject("Shell.Application")
' copy the file to be archived to the new zip file
objShell.Namespace(strZipFileName).CopyHere strFileName,[COLOR=black yellow] 4 [/color]
' cleanup and exit
Set objShell = Nothing
End Sub
Public Sub Create_New_Zip_File(strZipFileName)
'Create empty Zip File
Dim objFSO As Object
Dim arrHex
Dim strBin As String
Dim i As Long
' create a new filesystemobject
Set objFSO = CreateObject("Scripting.FileSystemObject")
' this bit makes the file compressed
arrHex = Array(80, 75, 5, 6, 0, 0, 0, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
For i = 0 To UBound(arrHex)
strBin = strBin & Chr(arrHex(i))
Next
' create the file
With objFSO.CreateTextFile(strZipFileName, True)
.Write strBin
.Close
End With
' cleanup and exit
Set objFSO = Nothing
End Sub