RE: application.wait

Tech-Archive recommends: Fix windows errors by optimizing your registry



Okay, here goes...

Except for the 'application.wait' failing and, without it, the sub
continuing before the archive is complete, the following code seems to work:


Dim fs, f, s
Dim DefPath As String

DefPath = CurrentProject.Path
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If

If FileOrDirExists(DefPath & "AttdB_BE.ldb") = True Then

MsgBox "The database is in use, please try again later.", vbOKOnly,
"Sorry..."
mcrQuit

Else

Set f = Nothing
Set fs = Nothing

DefPath = CurrentProject.Path
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If

strDate = Format(Now, "yyyy-mm-dd")
sZipFile = DefPath & "BE Backups\AttdB_BE " & strDate & " (before).zip"

sFile = DefPath & "Attdb_BE.mdb"

'Create empty Zip File
NewZip (sZipFile)

Set oApp = CreateObject("Shell.Application")

oApp.Namespace(sZipFile).CopyHere sFile

'Keep script waiting until Compressing is done
On Error Resume Next
Do Until oApp.Namespace(sZipFile).Items.Count = 1
'Application.Wait (Now + TimeValue("0:00:01"))
Loop

Set oApp = Nothing

MsgBox "Run the update scripts...", vbOKOnly, "Simulate:"

End If

End Sub

--
BJM
ACE Assistant
Gary Allan High School

.



Relevant Pages

  • Re: Email Attachment Problem
    ... Add Option Explicit on top of your module and add a few dim lines in the sub ... > Dim strDate As String, DefPath As String, strbody As String ... > Dim FileNameZip, FileNameXls, FileNameEmail ...
    (microsoft.public.excel.programming)
  • Re: Unzip - multiple zips
    ... Many thanks for your help Ron ... Dim oApp As Object ... Dim DefPath As String ... Set oApp = CreateObject ...
    (microsoft.public.excel.programming)
  • Re: Unzip - multiple zips
    ... Many thanks for your help Ron ... Dim oApp As Object ... Dim DefPath As String ... Set oApp = CreateObject ...
    (microsoft.public.excel.programming)
  • Re: Unzip - multiple zips
    ... Dim oApp As Object ... Dim DefPath As String ... Set oApp = CreateObject ... that unzips a file and saves as unzipped. ...
    (microsoft.public.excel.programming)
  • Re: Unzip - multiple zips
    ... Dim oApp As Object ... Dim DefPath As String ... Set oApp = CreateObject ... that unzips a file and saves as unzipped. ...
    (microsoft.public.excel.programming)