[Libreoffice-bugs] [Bug 140485] Password does not get set to Protect Sheet when added through LibreOffice BASIC
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Thu Feb 18 16:30:26 UTC 2021
https://bugs.documentfoundation.org/show_bug.cgi?id=140485
--- Comment #2 from An-Kh <anshukhare50 at gmail.com> ---
(In reply to Uwe Auer from comment #1)
> The problem is with
>
> > If IsMissing(pPassword) Then pPassword = "SomePassword"
>
> which does not set the password pPassword to "SomePassword". Runtime
> function "IsMissing" tests if a function is called with an _optional_
> parameter and function "LockSheet" has no optional parameter. called
> pPassword. Therefore pPassword stays empty and protection is activated with
> an "empty" password. Change the code to something like:
>
> >Sub LockThisSheet
> > LockSheet("Sheet1")
> >End Sub
> >
> >Function LockSheet(passedSheetname, optional pPassword )
> >
> > Dim oDoc As Object : oDoc = ThisComponent
> > Dim oSheet As Object : oSheet = oDoc.Sheets.getByName(passedSheetname)
> >
> > If IsMissing(pPassword) Then pPassword = "SomePassword"
I think that in this line it says that if the pPassword is missing set the
pPassword to "SomePassword". Since here pPassword is missing, pPassword is set
to "SomePassword".
> > oSheet.UnProtect(pPassword)
> > oSheet.Protect(pPassword)
Here it protects the sheet with pPassword
> >
> >End Function
>
> From my perspective not a bug
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210218/34fcb6c2/attachment-0001.htm>
More information about the Libreoffice-bugs
mailing list