Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用宏在Excel中编辑页面页脚_Excel_Vba - Fatal编程技术网

使用宏在Excel中编辑页面页脚

使用宏在Excel中编辑页面页脚,excel,vba,Excel,Vba,使用Excel(Office 2010),我将使用相同的页脚在横向打印。我制作了一个宏,将工作簿从纵向更改为横向,但是Excel/VB似乎不喜欢用宏编辑页面的页脚 您是否能够使用宏(可能使用VB代码解决方案)或其他方式编辑页脚?您是否尝试录制宏?我清理了这个,但这是直接从Excel 2003 Sub setFooter() On Error GoTo HandleErrors '@JimmyPena pointed out an msdn example that seems useful

使用Excel(Office 2010),我将使用相同的页脚在横向打印。我制作了一个宏,将工作簿从纵向更改为横向,但是Excel/VB似乎不喜欢用宏编辑页面的页脚


您是否能够使用宏(可能使用VB代码解决方案)或其他方式编辑页脚?

您是否尝试录制宏?我清理了这个,但这是直接从Excel 2003

Sub setFooter()

On Error GoTo HandleErrors 
'@JimmyPena pointed out an msdn example that seems useful to incorporate
Application.PrintCommunication = False 

    With ActiveSheet.PageSetup
        .Orientation = xlLandscape
        .LeftFooter = "What"
        .CenterFooter = "a"
        .RightFooter = "Header"

    End With
Application.PrintCommunication = True 

ExitHere: 
    Exit Sub 

HandleErrors: 
    ' If an error occurs, make sure you reset 
    ' print communications. 
    Application.PrintCommunication = True 
    Resume ExitHere 
    End Sub

除非您有我不理解的其他问题

我确实试过录制宏,但它不会录制我在页脚中的书写。它记录了所有的东西,但不是页脚。对不起,我在2003年录制了,然后将宏转移到2010年尝试。因为我在2010年总是迷路。但是它仍然显示,当您在宏.RightFooter、.CenterFooter和.LeftFooter中选择其中一个示例页脚时,您可以尝试更改这些页脚,即使(我同意2010年的录制效果很差)并且没有显示我在2010年厌倦了它,它仍然有效,但奇怪的是,它不喜欢录制它…我个人不喜欢2007-10,因为它们对您的帮助太大,以至于+1更难,但您应该关闭与打印机的通信以加快对PageSetup属性的访问: