von proximacentauri » Do, 29.03.2007 15:58
Hallo!
Ich habe ein einfaches Makro aufgezeichnet was für einen Briefvorlage folgendes machen soll:
1. die Seitenvorlage auf "Briefkopf Kopie" ändern,
2. Dokument drucken,
3. die Seitenvorlage wieder auf "Briefkopf normal" ändern.
Das Makro habe ich auf eine Schaltfläche gelegt. Wenn ich nun darauf klicke, stürzt OO ab. Immer.
Was ist daran falsch???
Code: Alles auswählen
sub Kopie
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 = "Template"
args1(0).Value = "Briefkopf Kopie Seite 1"
args1(1).Name = "Family"
args1(1).Value = 8
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Collate"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(1) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Template"
args3(0).Value = "Briefkopf Seite 1"
args3(1).Name = "Family"
args3(1).Value = 8
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args3())
end sub
Vielen Dank schonmal für hilfreiche Tipps!
Viele Grüße,
Alex
Hallo!
Ich habe ein einfaches Makro aufgezeichnet was für einen Briefvorlage folgendes machen soll:
1. die Seitenvorlage auf "Briefkopf Kopie" ändern,
2. Dokument drucken,
3. die Seitenvorlage wieder auf "Briefkopf normal" ändern.
Das Makro habe ich auf eine Schaltfläche gelegt. Wenn ich nun darauf klicke, stürzt OO ab. Immer.
Was ist daran falsch???
[code]sub Kopie
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 = "Template"
args1(0).Value = "Briefkopf Kopie Seite 1"
args1(1).Name = "Family"
args1(1).Value = 8
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Copies"
args2(0).Value = 1
args2(1).Name = "Collate"
args2(1).Value = false
dispatcher.executeDispatch(document, ".uno:Print", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(1) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Template"
args3(0).Value = "Briefkopf Seite 1"
args3(1).Name = "Family"
args3(1).Value = 8
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args3())
end sub[/code]
Vielen Dank schonmal für hilfreiche Tipps!
Viele Grüße,
Alex