TWiesendanger
9/7/2018 - 2:00 PM

Blattgrösse

'get active sheet
Dim oSheet As Sheet
oSheet = ThisDoc.Document.ActiveSheet
'get sheet size
Dim sSize As String
If oSheet.Size = DrawingSheetSizeEnum.kCustomDrawingSheetSize Then
sSize = "Custom Sheet Size"
Else If oSheet.Size = DrawingSheetSizeEnum.kADrawingSheetSize Then
sSize = "A"
Else If oSheet.Size = DrawingSheetSizeEnum.kBDrawingSheetSize Then
sSize = "B"
Else If oSheet.Size = DrawingSheetSizeEnum.kCDrawingSheetSize Then
sSize = "C"
Else If oSheet.Size = DrawingSheetSizeEnum.kDDrawingSheetSize Then
sSize = "D"
Else If oSheet.Size = DrawingSheetSizeEnum.kEDrawingSheetSize Then
sSize = "E"
Else If oSheet.Size = DrawingSheetSizeEnum.kFDrawingSheetSize Then
sSize = "F"
Else If oSheet.Size = DrawingSheetSizeEnum.kA0DrawingSheetSize Then
sSize = "A0"
Else If oSheet.Size = DrawingSheetSizeEnum.kA1DrawingSheetSize Then
sSize = "A1"
Else If oSheet.Size = DrawingSheetSizeEnum.kA2DrawingSheetSize Then
sSize = "A2"
Else If oSheet.Size = DrawingSheetSizeEnum.kA3DrawingSheetSize Then
sSize = "A3"
Else If oSheet.Size = DrawingSheetSizeEnum.kA4DrawingSheetSize Then
sSize = "A4"
Else
End If
If sSize = "A0" Then
MessageBox.Show("A0", "SheetSize")
End If


Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
MessageBox.Show("Sheet Size = " & oSheet.Size, "Title")

If oSheet.Size = "9997" Then
Blattgrösse = "A4"
ActiveSheet.Sheet.Orientation = PageOrientationTypeEnum.kPortraitPageOrientation
Else If oSheet.Size = "9996" Then
Blattgrösse = "A3"
ActiveSheet.Sheet.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation
End If