在标题更改文本打印时,在Excel中使用VBA
问题:
打印时如何更改标题中的文本。
将下面的代码放入常规模块中。
Sub VariableRow() Dim intCount As Integer, intCounter As Integer Range("A1").Select intCount = ExecuteExcel4Macro("INDEX(GET.DOCUMENT(50),1)") Sheet1.PageSetup.PrintTitleRows = "1:1" For intCounter = 1 To intCount Range("A1").Value = "RepetitionLine " & intCounter & ". Page" ActiveSheet.PrintOut from:=intCounter, to:=intCounter Next intCounter Range("A1").Value = "RepetitionLine" End Sub