标题:求教:Word打印PDF设置OutputFileName后PDF文件损坏
取消只看楼主
xia95
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2021-6-26
结帖率:0
已结贴  问题点数:20 回复次数:2 
求教:Word打印PDF设置OutputFileName后PDF文件损坏
程序代码:
Sub 宏1()
'
' 宏1 宏
'
'
    Dim path As String
    path = "F:\一户一档\"
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.getfolder(path)
    Set sfs = f.SubFolders
    For Each sf In sfs
        ChangeFileOpenDirectory (sf)
        Documents.Open FileName:="01不动产登记申请书.doc", ConfirmConversions:=False, _
        ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
        Application.PrintOut Background:=False, Append:=False, Range:=wdPrintAllDocument, OutputFileName:=sf & "\01不动产登记申请书.pdf", Copies:=1, PageType:=wdPrintAllPages, PrintTOFile:=True, Collate:=True, ManualDuplexPrint:=False
        ActiveWindow.Close
        Documents.Open FileName:="03不动产权籍调查表.doc", ConfirmConversions:=False, _
        ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
        Application.PrintOut Background:=False, Append:=False, Range:=wdPrintAllDocument, OutputFileName:=sf & "\03不动产权籍调查表.pdf", Copies:=1, PageType:=wdPrintAllPages, PrintTOFile:=True, Collate:=True, ManualDuplexPrint:=False
        ActiveWindow.Close
    Next
End Sub

搜索更多相关主题的帖子:  path PDF False Word 
2021-06-26 11:25
xia95
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2021-6-26
得分:0 
回复 楼主 xia95
2021-06-26 11:26
xia95
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2021-6-26
得分:0 
回复 楼主 xia95
把OutputFileName:=sf & "\01不动产登记申请书.pdf", PrintTOFile:=True去掉可以正常打印,不过每一个都要手动选择路径保存
2021-06-26 12:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506099-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026052 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved