Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]word报表可以代码打印指定页吗?

1楼
ybmjy 发表于:2024/1/11 16:17:00
同标题
2楼
有点蓝 发表于:2024/1/11 16:58:00
要使用vba,比如打印第3页,大概

Dim str As String = "D:\问题\2022.doc"
Dim app As New MSWord.Application
Try
    Dim doc = app.Documents.Open(str)
    doc.PrintOut(From:=3,To:=3)
    doc.close()
    app.quit()
Catch ex As Exception
    MsgBox(ex.Message)
    app.quit()
End Try

https://learn.microsoft.com/zh-cn/office/vba/api/word.document.printout
3楼
ybmjy 发表于:2024/1/12 16:46:00
Dim str As String = ProjectPath & "Reports\普工试卷.doc"
Dim app As New MSWord.Application
Try
    Dim doc = app.Documents.Open(str)
    doc.PrintOut(From:=3, To:=3)
    doc.close()
    app.quit()
Catch ex As Exception
    MsgBox(ex.Message)
    app.quit()
End Try
4楼
ybmjy 发表于:2024/1/12 16:50:00
不可用,提示:RPC服务器不可用

[此贴子已经被作者于2024/1/12 16:51:13编辑过]
5楼
有点蓝 发表于:2024/1/12 17:07:00
doc.PrintOut(From:=3, To:=3)
改为
doc.PrintOut(From:="3", To:="3")
共5 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03857 s, 2 queries.