Ok, This is my first post, and I'm fairly new to OpenOffice Macros. What I am trying to do is create a macro to protect a sheet after another macro is run that unprotects and copies a master sheet. I want it to automatically fill in the password so that the end user doesn't have the option to enter the password, or even know that it happened. For the sake of discussion, let's make the password "Pass1" EDIT: Also, what if the password were blank?
Here is what i have so far:
Code: Select all
sub ProtectSheet
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Protect"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:Protect", "", 0, args1())
end sub
I'm sure it is an easy solution, but I can't find it anywhere that I have looked. Please help.
Thanks in advance.