excel - 使用 VBA 打印外部 Excel 文件
问题描述
我有一个 Excel 文件,其中有 5 个选项卡,说“附件”。
我还有另一个正在工作的 Excel,说“请求”。
因此,我需要使用 VBA 从“请求”中的“附件”中快速打印其中一个 excel。
请帮忙!
但我看到其中一些展示了如何打印 PDF(不适合我)。
Sub Test()
PrintFile ("C:\Test.pdf")
End Sub
解决方案
如果有可打印的 pdf 并且它正在与 VBA 一起使用,这是代码
- 打开指定的 pdf 并使用默认打印机打印
- 请注意,它使用默认的 PDF 程序并保持打开状态
Sub PrintChecklistExcav_Backfill()
Dim strPth As String, strFile As String
strPth = "C:\File"
strFile = "name of document.pdf"
If Not PrintPDF(0, strPth & strFile) Then
MsgBox "Printing failed"
End If
End Sub
文件位置的strPth
strFile为文档名称
推荐阅读
- machine-learning - 如何改进 catboostregressor?
- arrays - 设置动态数组的界限
- asp.net-core - 如何在 Asp core 中部署两个项目(Razor 和 Api)
- android - Espresso 单元测试 NullPointerException
- javascript - Cypress.screenshot 停电 svg 元素
- reactjs - 有没有办法在grapesjs中将“-State-”的默认selectManager状态名称更改为默认值?
- design-patterns - 有人可以回答给定的场景吗?我一直试图理解但完全卡住了
- swift - 按下检索按钮时,我想在文本字段中显示保存的用户名和密码
- matlab - 为什么我的 LSTM 网络显示的全局训练精度低于 100%,即使过去 20-30 个时期中所有批次的小批量精度为 100%?
- python - 在 pandas pivot_table 函数中重新排序数据