von dabjoern » Di, 29.11.2005 08:43
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:
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
Wer kann helfen?
Grüße
dabjoern
Ich habe diesen Beitrag im englischen Forum gefunden:
http://www.oooforum.org/forum/viewtopic.phtml?t=12682&highlight=write+protection
Leider hab ich es noch nicht zum Laufen gebracht. Es kommt immer der Fehler "Basic-Laufzeitfehler. Objektvariable nicht belegt."
Hier mein Makro:
[code]
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
[/code]
Wer kann helfen?
Grüße
dabjoern