У меня есть простой макрос Excel (ниже), который просто меняет ориентацию от Portrait to Landscape. Я использовал инструмент «запись макроса» Excel, но когда я использую этот макрос, он игнорирует команды. Кто-нибудь еще видел это? И есть ли хорошее решение?Excel VBA Игнорирование изменений PageSetup
Sub Writedown_Format_Landscape()
'
' Writedown_Format_Landscape Macro
Range("A1").Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = "&D - &T"
.CenterHeader = "&F"
.RightHeader = "&P/&N"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Range("A1").Select
End Sub