Hallo,
ich möchte ein Makro erstellen, das einen bestimmten Bereich des Writer-Dokuments mit Passwort schützt. Wenn ich es manuell mache und das Makro aufzeichne, wird die Aktion "Einfügen | Bereich | Schreibschutz" nicht in dem Makro aufgezeichnet. Danke im Voraus.
Grüße
dabjoern
Makro für Bereich schützen
Moderator: Moderatoren
-
- Beiträge: 5
- Registriert: Mo, 28.11.2005 19:53
- Kontaktdaten:
Ich habe diesen Beitrag im englischen Forum gefunden:
http://www.oooforum.org/forum/viewtopic ... protection
Leider hab ich es noch nicht zum Laufen gebracht. Es kommt immer der Fehler "Basic-Laufzeitfehler. Objektvariable nicht belegt."
Hier mein Makro:
Wer kann helfen?
Grüße
dabjoern
http://www.oooforum.org/forum/viewtopic ... protection
Leider hab ich es noch nicht zum Laufen gebracht. Es kommt immer der Fehler "Basic-Laufzeitfehler. Objektvariable nicht belegt."
Hier mein Makro:
Code: Alles auswählen
sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "PageStyle"
args1(0).Value = "Standard"
args1(1).Name = "On"
args1(1).Value = true
dispatcher.executeDispatch(document, ".uno:InsertPageHeader", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Text"
args2(0).Value = "Name - Matrikel"
dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args2())
ThisComponent.CurrentController.getViewCursor.textSection.IsProtected=true
end sub
Grüße
dabjoern
Ich habe noch dieses Makro auf http://www.oooforum.org/forum/viewtopic ... xt+section gefunden:
Grüße
dabjoern
Code: Alles auswählen
Sub InsertIntroductionSection
Dim objDocument As Object
Dim objText As Object
Dim objIntroVCursor As Object
Dim objIntroTCursor As Object
objDocument = ThisComponent
objText = objDocument.Text
objIntroVCursor = objDocument.currentcontroller.getViewCursor()
objIntroTCursor = objText.createTextCursorByRange(objIntroVCursor.getStart())
objIntroSection = objDocument.createInstance("com.sun.star.text.TextSection")
objIntroSection.isProtected = TRUE
objText.insertTextContent(objIntroTCursor, objIntroSection, FALSE)
End Sub
dabjoern