excel - 如何加快将选定单元格打印到 pdf 文件并将 xlsm 文件保存到共享设备?
问题描述
我刚刚在 VBA 中编写了 MS 宏脚本,它选择要打印到 pdf 文件的单元格并将 pdf 和 xlsm 文件保存在共享设备中(在这种情况下,我有 Raspberry Pi)。当我选择单元格 A1:X51 时,它会打印出来,但需要很长时间。我试过添加那几行代码:
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveSheet.DisplayPageBreaks = False
但这些都没有帮助。我现在有一个问题:是否可以加快打印选定单元格并将 pdf 和 xlsm 文件保存到共享设备的速度?
提前致谢。
宏代码:
Sub SaveFile()
'
' Macro Macro
'
'
ActiveSheet.PageSetup.PaperSize = xlPaperLegal
ActiveSheet.PageSetup.PrintArea = Selection.Address
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="\\raspberrypi\Home_share\File.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveSheet.DisplayPageBreaks = False
ActiveWorkbook.SaveAs "\\raspberrypi\Home_share\File-TV.xlsm"
ActiveWorkbook.Close
End Sub
解决方案
推荐阅读
- http - origin 和 x-forwarded-host http 标头之间的区别
- python - Python中X轴上的备用主要刻度长度
- python - 如何使用 url 作为查询以使用请求和 twitter API 抓取推文
- .net - 带有 TransferMode.Streamed 的 WCF NetTcpBinding 在 WCF 绑定上使用 TLS 1.2 和 SslProtocols.None 的 Windows Server 2019 上不起作用
- mysql - 维护 MySQL 和 Redis 之间的数据完整性
- sql - 如何使用 SQL 语句只更新 excel 数据集中的一列
- .net - 将 32 位 VB.Net 连接到 64 位 Access .ACCDB
- javascript - 如何在某些标签之后找到所有输入元素并将函数应用于它们?
- javascript - 是否可以使用 popstate 仅定位浏览器后退按钮?
- admob - 如何获取 AdMob 广告的设备 ID?