View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jialiang Ge [MSFT] Jialiang Ge [MSFT] is offline
external usenet poster
 
Posts: 118
Default Excel Calculation is faster when visible than when Visible=Fal

Hello Jeff,

There seems something wrong with newsgroup post synchronization in this
thread. I am sorry for it. Below is my initial response posted on March 25.


Hello Jeff,

From your post, my understanding on this issue is: you wonder why the
ImportDataFromFile process is extremely slow only when
Excel.Application.Visible = false, and how to resolve it. If I'm off base,
please feel free to let me know.

First off, I suggest we identify which part of code in ImportDataFromFile
slows down the whole process when Application.Visible=false. Below are the
two possible approaches that can help us identify the location:

Approach 1. Debug the code lines. Step over each line of code in
ImportDataFromFile, and see which line hangs for a extremely long time. If
you are using Visual Studio, we can step over the code lines by pressing
F10.
Approach 2. Use a stop watch class to calculate each line's execution time:
http://www.codeproject.com/KB/vb/vbnetstopwatch.aspx. An
easier-to-implement stop watch is like:
Dim start As DateTime = DateTime.Now
'execute our code
Dim [end] As DateTime = DateTime.Now
Dim span As TimeSpan = [end] - start

I think knowing which part of code slows down the process may help us
determine the underlying reason for the performance issue.

In addition, Jeff, I suggest you call Worksheet.EnableCalculation = False.
This will disable the recalculation of the sheet, and may accelerate the
import process.
http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

Does your target worksheet contain a lot of function(UDF) to be calculated?

If Visible is set to true, is there any dialog popped up on your side when
the ImportDataFromFile is processed?



Again, I am sorry for the inconveniences caused by the newsgroup system. I
have reported the system problem to the system owner through internal
channels. They will look into it and fix the problem.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================