Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.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
VBA excel设置打印区域_Excel_Vba - Fatal编程技术网

VBA excel设置打印区域

VBA excel设置打印区域,excel,vba,Excel,Vba,我正在使用命名范围设置一个打印区域,因为它是一个表,并且会增长。 执行时,标题不会打印。如何调整以打印命名的rangeTable3和标题 我试过了; ActiveSheet.PageSetup.PrintArea=RangeTable3{Headers}.Address 但只打印标题 Application.Dialogs(xlDialogPrinterSetup).Show Application.PrintCommunication = False With ActiveSh

我正在使用命名范围设置一个打印区域,因为它是一个表,并且会增长。 执行时,标题不会打印。如何调整以打印命名的rangeTable3和标题

我试过了; ActiveSheet.PageSetup.PrintArea=RangeTable3{Headers}.Address 但只打印标题

Application.Dialogs(xlDialogPrinterSetup).Show
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .PrintTitleRows = ""
        .PrintTitleColumns = ""
    End With
    Application.PrintCommunication = True
    ActiveSheet.PageSetup.PrintArea = Range("Table3").Address
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
我想打印标题和表3。

表是一个表格。使用该属性返回表引用的范围,包括标题

Dim myTbl as ListObject
Set myTbl = ThisWorkbook.Sheets("mysheetname").ListObjects("Table3")
...
ThisWorkbook.Sheets("mysheetname").PageSetup.PrintArea = myTbl.Range.Address

根据需要更改图纸名称。

正确。我得到了表3,但没有标题。我知道当将范围命名为表3时,我选中了表示我的表有标题的框。不知道结果会怎样。