Print Method Explanation and Elaboration


I have a Writer document that has dynamically changing content and thus needs a macro to effectively print (instead of hundreds of manual print dialogues) and I am fiddling around with some print methods and properties found at: Everything in my macros for my dynamic document all work correctly (including the general print property changes), besides the PagePrintSettings. The PagePrintSettings seem to fail at runtime and I am not sure why. Are the margins supposed to not be a string? I have tried making them both integers and floats to no success (as well as strings, obviously). I am sure I have made a small mistake somewhere. Can anyone explain a little bit of the print properties/methods and give some working examples? Also, are the margins in TWIPS? Is that perhaps why it is not working?

Sub TemporaryWriterPrintPropertyTesting

rem Define variables.
Dim printerOption(0) As New
Dim pagePrinterOption(0 to 4) As New

rem Set "general" print properties.
printerOption(0).Name = "DuplexMode"
printerOption(0).Value =
ThisComponent.Printer = printerOption()

rem Set Writer exclusive print properties.
pagePrinterOption(0).Name = "LeftMargin"
pagePrinterOption(0).Value = "0.25"
pagePrinterOption(1).Name = "RightMargin"
pagePrinterOption(1).Value = "0.25"
pagePrinterOption(2).Name = "TopMargin"
pagePrinterOption(2).Value = "0.25"
pagePrinterOption(3).Name = "BottomMargin"
pagePrinterOption(3).Value = "0.25"
pagePrinterOption(4).Name = "IsLandscape"
pagePrinterOption(4).Value = True

rem "BASIC runtime error.;                                     An exception occurred;  
rem  Type:;                  Message: ."
rem This line is where I get the error above V
End Sub

Ah, I have figured out the problem. I was a goof and the margins actually need to be TWIPS. facepalm

So, each margin would be set to the integer 360 (1440 TWIPS = 1 Inch).

However, it doesn’t seem the duplex option is being set; is there a reason for that?