View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Scott Lyon Scott Lyon is offline
external usenet poster
 
Posts: 20
Default How do I unprotect cells when using OpenText function?

My Excel application needs to programmatically import data from a text file.
The fastest way I've found to do that is to use the following line (where
lFile is a string containing the path and filename of the file to read):

Workbooks.OpenText Filename:=lFile, DataType:=xlDelimited, Tab:=True


Then I do:

Selection.Copy

with the "imported" file xls file active.


Then it activates the original workbook (the destination), and does:

Range(strPasteStartPosition).Select
ActiveSheet.Paste



But it seems that when I do that, all of the cells wind up "Locked"... I'd
like it if I could set up the destination to keep/remember which cells
should be locked, and which should not. Barring that, I would need to import
the cells all as "unlocked".


And as for the idea of doing two nested FOR...NEXT loops, to change the
Cells().Locked property to True, it seems that this tends to add about 500%
onto the time it takes to "load" each file, which makes that unacceptable.


Is there an easier way to do this?


Thanks!
-Scott