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

Scott,

The default for each cell in a worksheet is "Locked". You will have to
reset this (if needed). But it is only an issue if the sheet is protected.

steve

"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM wrote in
message ...
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