MS VBA to modify Excel Worksheet Layouts

Please find attached a spreadsheet (.xls) that applies a macro to a selected workbook (.xlsm). The worksheets need the layout of Landscape and fit to one page.

The code below calls a macro to do the formatting and the layout is called next.

How can the code be modified to format the page layouts?

Sub WorksheetsByCodeName(wb As Workbook)
Dim ws As Worksheet
For Each ws In wb.Worksheets
If UCase(ws.CodeName) <> "SHEET10" Then
' do calculations for all other sheets
Call McrRisk(ws)
McrLayout
End If
Next ws
End Sub

Who is Participating?

McrLayout is working on the active sheet. You should pass it the worksheet to be used instead. I added error -handling because I was having problems with restoring print communication

Sub WorksheetsByCodeName(wb As Workbook)Dim ws As Worksheet For Each ws In wb.Worksheets If UCase(ws.CodeName) <> "SHEET10" Then ' do calculations for all other sheets Call McrRisk(ws) Call McrLayout(ws) End If Next wsEnd Sub

Yes, changing the size to 1 enabled one of the worksheets to have the correct layout but the others are portait and not fit to 1, I was hoping that calling the code within each worksheet would provide the correct layout?
Sub WorksheetsByCodeName(wb As Workbook)
Dim ws As Worksheet
For Each ws In wb.Worksheets
If UCase(ws.CodeName) <> "SHEET10" Then
' do calculations for all other sheets
Call McrRisk(ws)
Call McrLayout
End If
Next ws
End Sub