G
Guest
Hello,
I have made a migration from VB 6.0 to VB.NET and noticed a great speed
change when I access (from VB) to Excel Cells (same problem to write Visio
formulas from VB).
The same code takes 21 seconds in VB 6.0 and 54 seconds in VB.NET (see below)
1. Is that fact well known?
2. How to solve the problem?
3. Can we hope amelioration in latter version?
---------------------------------------------------------
In VB 6.0 the following code is executed in 21 seconds in VB 6.0 and 54
seconds in VB.NET on the same PC:
Dim I As Integer
Dim J As Integer
Dim myExcelApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim dStart As Double
Set myExcelApp = CreateObject("Excel.Application")
Set objBook = myExcelApp.Workbooks.Add("D:\toto.xls")
Set objSheet = objBook.Worksheets("Sheet1")
dStart = Timer
For I = 1 To 60
For J = 1 To 100
objSheet.Cells(J, I).Value = 1
Next J
Next I
MsgBox ("This operation took : " & CStr(CInt(Timer - dStart)) & "
seconds")
--------------------------------------------------------------------------------------
Thank you
Philippe
PS : To make yourself the experience on VB.NET, just replace in this VB 6.0
code "Timer" by "Microsoft.VisualBasic.Timer"
I have made a migration from VB 6.0 to VB.NET and noticed a great speed
change when I access (from VB) to Excel Cells (same problem to write Visio
formulas from VB).
The same code takes 21 seconds in VB 6.0 and 54 seconds in VB.NET (see below)
1. Is that fact well known?
2. How to solve the problem?
3. Can we hope amelioration in latter version?
---------------------------------------------------------
In VB 6.0 the following code is executed in 21 seconds in VB 6.0 and 54
seconds in VB.NET on the same PC:
Dim I As Integer
Dim J As Integer
Dim myExcelApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim dStart As Double
Set myExcelApp = CreateObject("Excel.Application")
Set objBook = myExcelApp.Workbooks.Add("D:\toto.xls")
Set objSheet = objBook.Worksheets("Sheet1")
dStart = Timer
For I = 1 To 60
For J = 1 To 100
objSheet.Cells(J, I).Value = 1
Next J
Next I
MsgBox ("This operation took : " & CStr(CInt(Timer - dStart)) & "
seconds")
--------------------------------------------------------------------------------------
Thank you
Philippe
PS : To make yourself the experience on VB.NET, just replace in this VB 6.0
code "Timer" by "Microsoft.VisualBasic.Timer"