Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unprotect specfic cells in worksheet ND at sib Excel Worksheet Functions 3 December 30th 08 04:27 PM
Protect / unprotect function sg Excel Worksheet Functions 3 December 6th 07 05:43 AM
Cells locking after Protect/Unprotect Geoff Excel Discussion (Misc queries) 2 August 26th 07 10:20 PM
How do I unprotect certain cells in a protected sheet? Lee Garrett Excel Worksheet Functions 1 January 26th 06 04:38 AM
OpenText bug ? Orlando Magalhães Filho Excel Programming 0 August 1st 03 04:14 AM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"