您的位置:首页 > 其它

excel 打开后自动打印

2012-02-09 09:27 411 查看


打开一个命名为auto_open的宏

auto_open 写在模块1里

宏的内容如下:

Sub auto_open() '设置一个自动运行的宏——auto_open

Application.OnTime TimeValue("08:30:00"), "tx" '设置提醒时间——08:30:00(可以根据需要修改),设置调用提醒宏——tx。

Application.OnTime TimeValue("08:52:00"), "tx" '再设置提醒一次。

End Sub

Sub tx() '设置一个显示提醒消息的宏(名称要与上述自动运行宏中调用的名称一致)。

Dim prtfileName As String

prtfileName = "e:\\abc.xps"

Sheets("Sheet1").Select

ActiveSheet.PrintOut From:=1, To:=1, PrintToFile:=True, Copies:=1, PrToFileName:=prtfileName

End Sub

PrintToFile:=True,PrToFileName:=prtfileName:写上这两参数,就会自动保存自动打印,不然会弹出对话框叫你保存,还是需要人工干预
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: