Accessing Multiple pages in a User locked excel document -
i trying create budget document in each department has access particular page - have part working - having trouble allowing admin access of pages. have code userform far: (i "scott" able open of pages not "overview")
dim bok2use boolean private sub btnok_click() dim berror boolean dim ssname string dim ws worksheet dim p documentproperty dim bsetit boolean bok2use = false berror = true if len(txtuser.text) > 0 , len(txtpass.text) > 0 berror = false select case txtuser.text case "scott" ssname = "overview" if txtpass.text <> "act2" berror = true case "chris" ssname = "run crew" if txtpass.text <> "act2" berror = true case else berror = true end select end if if berror msgbox "invalid user name or password" else 'set document property bsetit = false each p in activeworkbook.customdocumentproperties if p.name = "auth" p.value = ssname bsetit = true exit end if next p if not bsetit activeworkbook.customdocumentproperties.add _ name:="auth", linktocontent:=false, _ type:=msopropertytypestring, value:=ssname end if bok2use = true unload userform1 end if end sub private sub userform_terminate() if not bok2use activeworkbook.close (false) end if end sub
thank you!
Comments
Post a Comment