M
Mike
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?
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?