View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default ms excel template memory increase


You might try setting myObject to Nothing at the end of the second macro.
It could be stacking.


"ms excel template memory increase" <ms excel template memory
wrote in message
...
Hello, i programing VB 6.0 and I have one MS Excel Application.
Public Sub S1()
Dim xTemplate As Object
.
.
.
Set xTemplate = CreateObject("Excel.Application")
For i=0 To N
S2(strFile)
Next i
.
.
.
If Not xTemplate Is Nothing Then
xTemplate.Quit
Set xTemplate = Nothing
End If

End Sub


Public Sub S2(strFile)
.
.
.
On Error GoTo 2
Set mObject = GetObject(, "Excel.Application")
If False Then
2: err.Clear
Set mObject = CreateObject("Excel.Application")
End If
On Error GoTo 0
Set mObject = mObject.Workbooks.Open(strFile)
.
.
.
With xSheet.Application
.Workbooks.Open(sPath)
.WorkSheets(1).Activate
.DisplayAlerts = False
.ActiveWorkbook.Worksheets(1).Delete
.ActiveWorkbook.Save
.DisplayAlerts = True
.ActiveWorkbook.Close
End With
.
.
.
End Sub

Memori increased every i in for cycle.
Help meeeeeeeeeeeeeeeeeeeeeeeeee................:((((