如何在特定时间打印多个电子表格?

如何在特定时间打印多个电子表格?

我有一个 Excel 工作簿,里面有多张工作表。有没有办法让一张工作表在早上 8:00 自动打印,另一张工作表在早上 10:00 自动打印,还有一张工作表在中午 12:00 自动打印,依此类推?

我仍在使用 Office 2003

答案1

首先;欢迎来到超级用户

如果您熟悉 Excel 中的宏/VBA,则可以使用以下代码开始。抱歉,这对我来说是可行的,但在给您之前我没有 Excel 2003 来测试它。这意味着我无法保证它会在您不做额外工作的情况下为您工作。

将其复制并粘贴到 VBA 模块中。您需要将工作表名称更改为选项卡的名称。

Private Sub Workbook_Open()
Run "timer"
End Sub

Sub timer()
Application.OnTime TimeValue("08:00:00"), "Print_1"
Application.OnTime TimeValue("10:00:00"), "Print_2"
Application.OnTime TimeValue("12:00:00"), "Print_3"
End Sub

Sub Print_1()
' Prints the sheet for 8am
    Sheets("sheet1").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub

Sub Print_2()
' Prints the sheet for 10am
    Sheets("sheet2").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub

Sub Print_3()
' Prints the sheet for 12pm
    Sheets("sheet3").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub

希望这对你有帮助。

注意:系统采用 24 小时制。因此,若要使用中午之后的时间,请在此基础上加 12。例如,下午 3 点为 15:00:00。

相关内容