よろずやネット

最近はLibreofficeにハマっています。

LibreOffice Calc、用紙の向き(縦長、横長)を設定する

印刷ジョブの基本、用紙の向きを設定するマクロです。
Sub SetPageOrientation

Sub SetPageOrientation
'	列挙型(enumeration type)を使用 'Enum PaperOrientation
'	https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1view.html
	Dim oOptions(0) As New com.sun.star.beans.PropertyValue
	Dim oSheetStyle As Object
	oSheetStyle = ThisComponent.StyleFamilies.getByName("PageStyles").getByName("Default") 

	oOptions(0).Name = "PaperOrientation"
	oOptions(0).Value = com.sun.star.view.PaperOrientation.PORTRAIT '  LANDSCAPE
	
	ThisComponent.Printer = oOptions()
	
	oSheetStyle = Nothing
	Erase oOptions()
	
End Sub