ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ms excel template memory increase (https://www.excelbanter.com/excel-programming/430885-ms-excel-template-memory-increase.html)

ms excel template memory increase

ms excel template memory increase
 

Hello, i programing VB 6.0 and I have one MS Excel Application.
Public Sub S1()
Dim xTemplate As Object

JLGWhiz[_2_]

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................:((((




ms excel template memory increase[_2_]

ms excel template memory increase
 



"JLGWhiz" wrote:

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................:((((




I use existing Excel Application and every time not create Application, this
is very slow.
I'm sorry but I hav'nt myObject object?


All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com