LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Worksheet Protection

Hello,

I'm using Access/Excel 2003. From within a Windows From in Access, I have
VBA that unprotects a an Excel worksheet. It doesn't appear to be working.

Here is the code:

1: xlsApp.Worksheets("Sheet1").UnProtect Password:="peter"
2: xlsCurrentWorksheet.Range("B11:AF" & CStr(10 +
intRecords)).PasteSpecial xlPasteAll

Line 2 above is throwing an error on the PasteSpecial method of the Range
object. But, the same exact Line 2 works if the worksheets is unprotected to
begin with, and Line 1 is removed. I have manually protected the worksheet
from within Excel before saving it, added Line 1, and now Line 2 fails.

So to summarize: from Access VBA, if I use an unprotected worksheet, Line 2
works. But from Access VBA, if I use a protected worksheet and add Line 1,
Line 2 fails. I can only assume Line 1 is not working correctly.

While in Excel VBA, all of the code works, meaning, I have zero problems
protecting/unprotecting worksheets from within Excel VBA, and have many lines
similar to Line 2 above in my Excel VBA, all of which work. It is only
trying to manipulate a protected worksheet from Access VBA that I started
having problems.

Any thoughts are appreciated!

Any ideas?

Thanks,

Scott
 
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
Worksheet protection ssdsibes Excel Worksheet Functions 1 June 26th 09 09:30 AM
worksheet protection mike Excel Discussion (Misc queries) 8 September 27th 07 03:51 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Worksheet Protection [email protected] Excel Discussion (Misc queries) 3 June 16th 05 11:29 PM


All times are GMT +1. The time now is 10:07 AM.

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"