Sub Main
'Reference
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
For Each oSheet In oDoc.Sheets
oSheet.Activate
'Delete Border if there is one
If Not oSheet.Border Is Nothing Then
oSheet.Border.Delete
End If
If Auswahl = "A4" Then
ActiveSheet.ChangeSize("A4", MoveBorderItems := False)
ChangeBorder ( "Mica_Rahmen_A4")
ElseIf Auswahl = "A3" Then
ActiveSheet.ChangeSize("A3", MoveBorderItems := False)
ChangeBorder ( "Mica_Rahmen_A3")
ElseIf Auswahl = "A2" Then
ActiveSheet.ChangeSize("A2", MoveBorderItems := False)
ChangeBorder ( "Mica_Rahmen_A2")
ElseIf Auswahl = "A1" Then
ActiveSheet.ChangeSize("A1", MoveBorderItems := False)
ChangeBorder ( "Mica_Rahmen_A1")
ElseIf Auswahl = "A0" Then
ActiveSheet.ChangeSize("A0", MoveBorderItems := False)
ChangeBorder ( "Mica_Rahmen_A0")
End If
'Orientation
If ActiveSheet.Size="A4" Then
ActiveSheet.Sheet.Orientation = PageOrientationTypeEnum.kPortraitPageOrientation
Else
ActiveSheet.Sheet.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation
End If
'Zoom in extends
ThisApplication.ActiveView.Fit
Next
End Sub
Sub ChangeBorder(borderName As String)
ThisApplication.UserInterfaceManager.DoEvents()
ActiveSheet.Border = borderName
End Sub