View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Klips Klips is offline
external usenet poster
 
Posts: 6
Default Slow Text File Import

On May 8, 8:17 am, Klips wrote:
On May 7, 5:18 pm, "Jim Cone" wrote:





Have you considered opening the text file directly into Excel
and then formatting the file. Excel plops a text file into the
first column of a worksheet in tenths of a second...


Sub OpenTextFile()
Workbooks.Open "F:\Acme\Z2Compliance.txt"
End Sub


Also, have you declared all of your variables?
The code you posted doesn't show anything declared.
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware


"Klips" wrote in ooglegroups.com...


Hi all,
I'm having problems finding out why the performance of my text file
import routine takes a hit after the first import operation. I have a
series of text files with a set format that I'd like to import into
individual sheets in excel. I have written a procedure that takes care
of this. The first file that I import is extremely fast. As soon as I
import the next file, the speed drops to 1/10 of the first time. The
speed deteriorates as I import more files, but the drop is more
gradual.


Here is the import code:
-snip-Any help is appreciated. If someone wants to take a look at the
complete file with sample text files, just let me know.
Thanks


The problem is that I'm not sure if this performance issue has
anything to do with reading the data in. I feel like it is more a
problem of how content gets assigned to cells. I have put all the code
in a textfile athttp://www.lapse.ca/code.txtin case you need to look
at it. I'm using Option Explicit, so variables seem to be all defined.
The code is executed by pushing a button on a userform.

Any help is appreciated.- Hide quoted text -

- Show quoted text -


Tim & Jim,

I read Tim's message again (and more carefully) and realized that my
method of using enablecalculation was in fact not preventing excel
from recalculating the entire workbook over and over again after each
cell input. As Tim had pointed out I needed to set the
Application.calculation parameter to manual in order for excel to stop
calculating the entire sheet until I was finished with my import
operation.

I'm sorry it took me a while to figure out. Thank you both for your
help.