The following code copies the current database and zips it up. However this does not work if the directory name has spaces in it, e.g. ...Documents and Settings\Desktop...
Dim fs
Dim strSource 'As String
Dim strTarget 'As String
Dim strLocation As String
‘MAKE COPY OF DATABASE
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfile strSource, strTarget
Set fs = Nothing
'ZIP COPY OF DATABASE
strLocation = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
strSource = CurrentDb.Name
strTarget = strLocation & "OffSite.mdb"
Call Shell("C:\Program Files\WinZip\WINZIP32.EXE -min -a -ex " & _
strLocation & "OffSite.zip" & " " & strTarget, vbHide)
I know many threads have been written on this topic already and I am sure I have trolled through them all but I cannot for the life of me see where I am going wrong.
As always all help is greatly appreciated.
Dim fs
Dim strSource 'As String
Dim strTarget 'As String
Dim strLocation As String
‘MAKE COPY OF DATABASE
Set fs = CreateObject("Scripting.FileSystemObject")
fs.copyfile strSource, strTarget
Set fs = Nothing
'ZIP COPY OF DATABASE
strLocation = Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))
strSource = CurrentDb.Name
strTarget = strLocation & "OffSite.mdb"
Call Shell("C:\Program Files\WinZip\WINZIP32.EXE -min -a -ex " & _
strLocation & "OffSite.zip" & " " & strTarget, vbHide)
I know many threads have been written on this topic already and I am sure I have trolled through them all but I cannot for the life of me see where I am going wrong.
As always all help is greatly appreciated.