ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   unprotect when file is shared (https://www.excelbanter.com/excel-programming/427205-unprotect-when-file-shared.html)

Kashyap

unprotect when file is shared
 
Hi, I have the below code but when I share workbook it does't work.. any help
pls

Sub UnP()
Dim wks As Worksheet
Dim strPassword

strPassword = InputBox("Enter the password", "Password")

ActiveSheet.Unprotect Password:=strPassword
Range("A4:I1000").Select
Selection.Locked = False
ActiveSheet.Protect contents:=False
ActiveSheet.Protect Password:=ActiveSheet.Range("P1").Value
Application.Goto Reference:="R4C1"
Selection.End(xlDown).Select

On Error GoTo 0

End Sub

gmorris[_5_]

unprotect when file is shared
 

First thing that comes to mind for me is version problems. I don't know
why, but when I try this in Excel2007 I get the error "Method 'Goto' of
object '_Application' failed". Why it has the underscore is a mystery to
me, I can only guess that it has something to do with the (most likely
C++) code that drives Excel. Possibly someone changed the method or
something before releasing 2007 version, but I'm not at all sure. That's
just my thoughts...


--
gmorris
------------------------------------------------------------------------
gmorris's Profile: http://www.thecodecage.com/forumz/member.php?userid=245
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=87977



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com