Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 not unprotecting worksheet!!!!
Hi,
I'm running Win XP and both XL2003 & XL2007. I've got an application (an .xls file, created in XL2003) with code that unprotects a worksheet, deletes certain shapes, the reprotects the sheet. However, in xl 2007, the code doesn't unprotect the sheet!? here's the code: .... shtTarget.unprotect gcstrPassword While intZ 1 With shtTarget.Shapes(intZ) If (.Name Like "pic_*") Then .Delete ....more code... To reiterate, So this file was created in excel 2003 and runs fine, but my company is converting to excel 2007 and one of my colleagues, who uses the file regularly, has switched. In XL2007, the .delete line gives me an error; so I manually unprotected the sheet and the code runs fine, so I thought something in the rest of my code re-protected the sheet. After creating an error handler (shttarget.unprotect password:=gcstrpassword / resume) to unprotect the sheet if .delete throws an error, I discovered that the error handler infinite loops, and that's when I realized the worksheet.unprotect doesn't actually unprotect! I have checked with application screenupdating true and false, enableevents true and false; there is no code that would fire to 'instantly relock' or anything like that. the password constant I'm using (gcstrpassword) is definitely correct... I'm at a loss... Anyone have any suggestions? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Xl2007 not unprotecting worksheet!!!!
do a check with just this one line
shtTarget.unprotect gcstrPassword if it fails - and your comments suggest that it will, record a macro to unprotect the sheet to see if it differs as far i can tell though, syntax is correct . but it is case dependent "Mike" wrote in message ... Hi, I'm running Win XP and both XL2003 & XL2007. I've got an application (an .xls file, created in XL2003) with code that unprotects a worksheet, deletes certain shapes, the reprotects the sheet. However, in xl 2007, the code doesn't unprotect the sheet!? here's the code: ... shtTarget.unprotect gcstrPassword While intZ 1 With shtTarget.Shapes(intZ) If (.Name Like "pic_*") Then .Delete ...more code... To reiterate, So this file was created in excel 2003 and runs fine, but my company is converting to excel 2007 and one of my colleagues, who uses the file regularly, has switched. In XL2007, the .delete line gives me an error; so I manually unprotected the sheet and the code runs fine, so I thought something in the rest of my code re-protected the sheet. After creating an error handler (shttarget.unprotect password:=gcstrpassword / resume) to unprotect the sheet if .delete throws an error, I discovered that the error handler infinite loops, and that's when I realized the worksheet.unprotect doesn't actually unprotect! I have checked with application screenupdating true and false, enableevents true and false; there is no code that would fire to 'instantly relock' or anything like that. the password constant I'm using (gcstrpassword) is definitely correct... I'm at a loss... Anyone have any suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unprotecting a worksheet | Excel Worksheet Functions | |||
Protecting & Unprotecting worksheet | Excel Programming | |||
Unprotecting a Worksheet | Excel Worksheet Functions | |||
unprotecting my worksheet | Excel Programming | |||
unprotecting a worksheet | Excel Discussion (Misc queries) |