10/11/2008, 19:05
Public Function AutoCompactCurrentProject()
Dim fs, f, S, filespec
Dim strProjectPath As String, strProjectName As String
strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "\" & strProjectName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
S = CLng(f.Size / 1000000) 'convert size of app from bytes to Mb’s
If S > 20 Then 'edit the 20 (Mb’s) to the max size you want to allow your app to grow.
Application.SetOption ("Auto Compact"), 1 'compact app
Else
Application.SetOption ("Auto Compact"), 0 'no don’t compact app
End If
End Function
Dim fs, f, S, filespec
Dim strProjectPath As String, strProjectName As String
strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "\" & strProjectName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
S = CLng(f.Size / 1000000) 'convert size of app from bytes to Mb’s
If S > 20 Then 'edit the 20 (Mb’s) to the max size you want to allow your app to grow.
Application.SetOption ("Auto Compact"), 1 'compact app
Else
Application.SetOption ("Auto Compact"), 0 'no don’t compact app
End If
End Function