A
andreas
Dear Experts:
Below macro lists sections with landscape orientation in a MsgBox. The
macro is running fine. There is two things I would like to have
different.
a) If just one (1) section features landscape orientation then the
"have" in the Message Box text should be replaced with "has".
b) If no (0) section breaks with landscape orientation are found, the
MsgBox text should say: "No sections with landscape orientation
found".
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub ReportLandscapeSections()
Dim strMessage As String
Dim i As Integer
Dim Sec As Section
strMessage = "Section "
For Each Sec In ActiveDocument.Sections
If Sec.PageSetup.Orientation = wdOrientLandscape Then
strMessage = strMessage & IIf(i > 0, ", ", "") & Sec.Index
i = i + 1
End If
Next Sec
MsgBox strMessage & " have landscape format."
End Sub
Below macro lists sections with landscape orientation in a MsgBox. The
macro is running fine. There is two things I would like to have
different.
a) If just one (1) section features landscape orientation then the
"have" in the Message Box text should be replaced with "has".
b) If no (0) section breaks with landscape orientation are found, the
MsgBox text should say: "No sections with landscape orientation
found".
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub ReportLandscapeSections()
Dim strMessage As String
Dim i As Integer
Dim Sec As Section
strMessage = "Section "
For Each Sec In ActiveDocument.Sections
If Sec.PageSetup.Orientation = wdOrientLandscape Then
strMessage = strMessage & IIf(i > 0, ", ", "") & Sec.Index
i = i + 1
End If
Next Sec
MsgBox strMessage & " have landscape format."
End Sub